Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: Not Quite Trivial - A Tip for using the Software UART with t

Re: Not Quite Trivial - A Tip for using the Software UART with t 8 years 10 months ago #15218

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352

Re: Not Quite Trivial - A Tip for using the Software UART wi 8 years 6 months ago #5494

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
ohararp brought up a good point on the Swordfish forum:
The software uart commands can put a hurt on smaller chips in terms of code space and ram but with most 18F parts I use this isn't really a problem.
To see the effect of including the software UART with half a dozen print states, I compiled the icemaker control program with and without the software UART, setup and print statements.

With, the result was:
3761 program bytes used
216 variable bytes used

Without:

2601 program bytes used
130 variable bytes used

so the software UART does have a considerable overhead!

Re: Not Quite Trivial - A Tip for using the Software UART wi 8 years 6 months ago #5495

I'm not sure how many times I have included a separate header for serial coms... NEVER AGAIN!!

The over heads are not that great on a scale of things (~2% resources for any newish PIC).

Cheers for sharing that Jon - what a great idea

Re: Not Quite Trivial - A Tip for using the Software UART wi 8 years 6 months ago #5598

  • MMcLaren
  • MMcLaren's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 13
  • Thanks received: 30
That seems like an awful lot of overhead Jon. Can I assume it's mostly the text and conversion of values to ASCII that's using most of that overhead? Or, is this "module overhead"? I can't imagine the TX driver itself using much more than 20-30 words of program memory and a couple variables.

Re: Not Quite Trivial - A Tip for using the Software UART wi 8 years 6 months ago #5599

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
You're right Mike. Most of that is "program overhead".

A simple program to send a byte (including setting the tx/rx pins and baudrate), comes in at about 360 bytes program/58 bytes ram. Most of the ram usage is system stuff... the suart itself uses about 16 bytes or so. The code to do the actual transmission takes a bit more than your estimate, maybe about 60-70 instructions.

Didn't bother looking at the receive side, since that's pretty much useless unless you're program doesn't do anything else.

Re: Not Quite Trivial - A Tip for using the Software UART wi 8 years 6 months ago #5606

  • MrDEB
  • MrDEB's Avatar
  • Offline
  • User is blocked
  • Thanks received: 14
I assume that just changing the TX pin to conside with the ICSP pin that the UART is then enabled?
Lost on your coment about normal mode is inverted?
as well as portB7 is normal transmit pin? Looking at the tap-28 schematic C6 is connected to the TX pin. LOST as to description.
Going to have to try this out using the Junebug after I decipher.
Time to create page: 0.252 seconds