Editing Serial Communications Library -- BoostC and 16F877A
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
=== Summary === | === Summary === | ||
− | |||
− | |||
*Name: Serial Communications Library -- BoostC and 16F877A | *Name: Serial Communications Library -- BoostC and 16F877A | ||
− | *Purpose: A C library ( in source code form ) for serial communications | + | *Purpose: A C library ( in source code form ) for serial communications together with a program demonstrating its use. |
− | *Status: This | + | *Status: This page in draft. Code works but still in refinement, code available, email [[russ_hensel]] |
− | *Technology: BoostC and PIC 16F877A | + | *Technology: BoostC and PIC 16F877A |
*Author: [[russ_hensel]] ( where you can find an email address to reach me ) | *Author: [[russ_hensel]] ( where you can find an email address to reach me ) | ||
*License: not fully determined, but open source and object code. | *License: not fully determined, but open source and object code. | ||
Line 13: | Line 11: | ||
This is one of a series of articles on Microcontroller Serial Communications, rooted at this site here: [[Microcontroller Serial Communications Articles]] | This is one of a series of articles on Microcontroller Serial Communications, rooted at this site here: [[Microcontroller Serial Communications Articles]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Features === | === Features === | ||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 29: | Line 18: | ||
|Feature | |Feature | ||
|Details | |Details | ||
+ | |||
+ | |||
|-valign="top" | |-valign="top" | ||
Line 45: | Line 36: | ||
|Transmit is blocking. | |Transmit is blocking. | ||
|During a transmit no activities that are not interrupt driven occur. | |During a transmit no activities that are not interrupt driven occur. | ||
+ | |||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
Line 53: | Line 45: | ||
|Command interface includes a stop command to halt long running operations. | |Command interface includes a stop command to halt long running operations. | ||
|Character is ! | |Character is ! | ||
+ | |||
+ | |||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
Line 60: | Line 54: | ||
|-valign="top" | |-valign="top" | ||
|Option to make single letter commands case insensitive. | |Option to make single letter commands case insensitive. | ||
+ | |||
+ | |||
+ | |||
| | | | ||
<!--------------------------------> | <!--------------------------------> | ||
Line 68: | Line 65: | ||
|-valign="top" | |-valign="top" | ||
|Beware of negative numbers which may not be handled as you expect. | |Beware of negative numbers which may not be handled as you expect. | ||
− | | | + | | |
− | <!-------------------------------- | + | <!--------------------------------> |
|-valign="top" | |-valign="top" | ||
| | | | ||
Line 110: | Line 107: | ||
− | [[Stepper Motor Tester]] has a Eagle file that will work for this demo. You can drop the stepper driver chip. Even the level shifter can be dropped if you use a cable with a level shifter. | + | [[Stepper Motor Tester]] has a Eagle file that will work for this demo. You can drop the stepper driver chip. Even the level shifter can be dropped if you use a cable with a level shifter. It is an easy project to do on a proto board. |
=== Compiling the Program === | === Compiling the Program === | ||
− | The code for the library and the demo program is in one zip file ( called | + | The code for the library and the demo program is in one zip file ( called .... ). Unzip into a directory of its own. Open the project file SerialDemo.__c and compile with the source boost compiler. The source files are SerialDemo.c SerialDemo.h..... |
− | |||
− | |||
− | |||
− | |||
Before you actually try it with real hardware review your clock frequency and baud rate settings in the code. | Before you actually try it with real hardware review your clock frequency and baud rate settings in the code. | ||
Line 126: | Line 119: | ||
Running the DemoSerial demo program ( demo is set up to be caps insensitive, if you comment out this feature use lower case commands ) | Running the DemoSerial demo program ( demo is set up to be caps insensitive, if you comment out this feature use lower case commands ) | ||
− | Once running the demo program supports the following commands. Use a terminal emulator set for | + | Once running the demo program supports the following commands. Use a terminal emulator set for..... One I like is ....... |
For full details on what each command does review the code, I have tried to fully comment the code so that it should be | For full details on what each command does review the code, I have tried to fully comment the code so that it should be | ||
− | fairly easy to read. I have generally avoided coding tricks. | + | fairly easy to read. I have generally avoided coding tricks. |
{| class="wikitable" | {| class="wikitable" | ||
Line 136: | Line 129: | ||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
− | |r | + | |r |
|Report the version of the software ( and possibly other infomation ). | |Report the version of the software ( and possibly other infomation ). | ||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
|! | |! | ||
− | |Stop whatever software is doing, give stopped message | + | |Stop whatever software is doing, give stopped message. |
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
− | |d | + | |d |
|Print out a series of numbers using serial_print_dec | |Print out a series of numbers using serial_print_dec | ||
(The library has different version of serial_print_dec for different argument types ) | (The library has different version of serial_print_dec for different argument types ) | ||
+ | |||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
− | |h | + | |h |
|Print out a series of numbers using print_hex. | |Print out a series of numbers using print_hex. | ||
+ | |||
+ | |||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
− | |b | + | |b |
|Print out a series of numbers using print_bin. | |Print out a series of numbers using print_bin. | ||
+ | |||
<!--------------------------------> | <!--------------------------------> | ||
|-valign="top" | |-valign="top" | ||
− | |e | + | |e |
|Echo a series of keystrokes as hex values. | |Echo a series of keystrokes as hex values. | ||
− | <!-------------------------------- | + | <!-------------------------------- |
|-valign="top" | |-valign="top" | ||
− | | | + | | |
− | | | + | | |
<!-------------------------------- | <!-------------------------------- | ||
|-valign="top" | |-valign="top" | ||
Line 202: | Line 199: | ||
=== Using the Library in Your Own Program === | === Using the Library in Your Own Program === | ||
− | |||
=== Code History === | === Code History === | ||
− | Origninal source code found, I think, on code on the SourceBoost website ( see program header for more inforation ). I have used the code on a series of different projects, it has evolvled with each one. I have added the code for a command interface, this is based on the idea that if you have serial capability then you may want to control | + | Origninal source code found, I think, on code on the SourceBoost website ( see program header for more inforation ). I have used the code on a series of different projects, it has evolvled with each one. I have added the code for a command interface, this is based on the idea that if you have serial capability then you may want to control it thru its serial connection. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |