Serial help
I have acquired one of THESE for a project. I was out of I/O lines, and need a 4-digit display. This seemed like a great idea, since I only need the SEROUT2 command and one pin (I'm using the hardware TX and RX for comms to another device).
The datasheet shows the following commands:
Example: Display 12Ab
To display 12Ab, any of the following 4-byte patterns would be acceptable:
[0x01][0x02][0x0A][0x0B] (Actual binary values 1, 2, 10 and 11)
[0x31][0x32][0x41][0x42] (ASCII-code for '1', '2', 'a', 'b')
Or any combination of binary and ASCII values could be used.
Sample Arduino Snippet (Serial mode):
// ... after initializing Serial at the correct baud rate...
Serial.write(0x01); // Hex value for 1, will display '1'
Serial.write('2'); // ASCII value for '2', will display '2'
Serial.write(0x0A); // Hex value for 10, will display 'A'
Serial.write('B'); // ASCII value for 'B', will display 'b'
It also mentions that CLEAR SCREEN is $76 (HEX 76).
I have never used serial on a PIC before, so I know I'm doing something wrong. When I use the following command:
Code:
SEROUT2 PORTB.3,84,[HEX 76]
Nothing happens. When I make a variable equal to HEX 76 and send that, still nothing, When I make two variables equal to 118 decimal ($76) and another variable equal to 7, I get '1187' in the display. I have tried IHEX as well, and still no joy. Anyone got any ideas what I'm doing wrong?
Thanks for any help
Andy
"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"
-Stephen Hawking
Bookmarks