uart with 8 databits + parity
Peter Verkaik
Posts: 3,956
Hi,
Unable to find an existing uart for 8 databits + parity I wrote one myself.
I saw a few posts on the basic stamp forum about this so I share this.
It is an assembly source.
The program itself contains more than just the uart as it is written as
a template to be extended for applications.
Details are in the source file.
To James Newton: you may host this file on sxlist.com if you want.
regards peter
Unable to find an existing uart for 8 databits + parity I wrote one myself.
I saw a few posts on the basic stamp forum about this so I share this.
It is an assembly source.
The program itself contains more than just the uart as it is written as
a template to be extended for applications.
Details are in the source file.
To James Newton: you may host this file on sxlist.com if you want.
regards peter
SRC
46K
Comments
I have modified your code to include a couple of user messages. This is not something that any code requires, but it is something I find very useful. Download this modified version and assemble it. You'll see that you get a pair of user messages that provide some info about the code that got assembled.
The first message is useful since you've designed the code to work at different oscillator frequencies. I find this sort of reminder handy when burning a chip, or when I am debugging and wondering why something is not working. While you can go into the code to find this information manually, I think having the assembler remind you every time is more convenient.
The second message may not be as useful, but it can be a fast way to interactively tweak a value until you get what you want. For example, if you wanted to get a specific number of cycles you could change a value, then assemble to see if you're getting closer or further. It can also be used as a sanity check to make sure that a formula is being parsed with the precedence you are expecting.
I post this not because I think your code needed it specfically, but rather to give a concrete example of a feature in SASM that I think is under used. I modified SASM to allow variables and constants in user messages, something that the current documentation has not been updated to reflect. Originally, the user warning messages did not allow any variables or constants to be used. By adding that feature, I think they become handy sentinels that give instant feedback or reminders that can be very useful during late nate programming or debugging.
Thanks, PeterM
Thanks.·The second warning however I find misleading.
It states the number of cycles per interrupt using mscount.
mscount is the number of isr cycles required for a 1 msec delay.
cycles per interrupt would be int_period in my opinion.
regards peter
Cool. I wasn't really trying to understand the code and make it better. I was just trying to point out the usage and grabbed the nearest variable that looked like it meant something. The point is that you can put any variable or constant into a user message and get meaningful feedback from the assembler. If you like the technique, then tweak the code to gsain the most information from the user message.
Thanks, PeterM