|
|
View previous topic :: View next topic |
Author |
Message |
mj Guest
|
0x80 sent from PIC--nothing else |
Posted: Wed Sep 05, 2007 3:51 pm |
|
|
When I send a variety of characters/values/etc from the PIC to the UART, my terminal program (RealTerm) only receives "80" (hex) regardless of what char/value/etc I send. I've done a search on the forums to see if this has been asked before and couldn't find anything; my apologies if it has been.
Code:
Code: |
#include <18f4550.h>
#use delay (clock = 8000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
int8 data_int8;
char data_char;
byte data_byte;
void main()
{
while(1)
{
data_int8 = 'A';
data_char = 'A';
data_byte = 'A';
delay_ms(20);
puts(data_int8);
puts(data_char);
puts(data_byte);
printf(" %d", data_char);
printf(" %d", data_int8);
printf(" %d", data_byte);
output_high(pin_b0);
delay_ms(200);
output_low(pin_b0);
delay_ms(200);
}
}
|
I have an ISR for RDA in there, but commented it out to troubleshoot. You can see my troubleshooting path (playing with the variable type); any ideas why I would only get 0x80?
BTW, my pin_B0 is just my 'heartbeat' sanity check that the PIC is running properly.
Thanks much. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 05, 2007 4:03 pm |
|
|
1. Don't use puts(). It requires a string, and you're giving it a byte
variable. Use putc() instead of puts().
2. The three data types, int8, char, and byte, are the same thing in CCS.
3. Post your #fuses statement. It should be placed on the next line
after the #include statement.
4. What baud rate, etc., is your terminal program set up to use ?
5. What is your terminal program ? |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|