Files
SyncHome/trunk/workspace/gcb/_MyFiles/SoftUART_12f1840.gcb
2023-03-09 12:51:54 +00:00

29 lines
774 B
Plaintext

'---------------------------------------------------
'Receive a char from Software-UART and send it back.
'---------------------------------------------------
'Chip model
#chip 12f1840, 4
'Set internal oscillator to 4 MHz
Set IRCF = b'1101'
'Set the pin directions
Dir PORTA.2 Out 'send on Pin 5
Dir PORTA.0 In 'receive on Pin 7 (PCD)
'Config Software-UART
#define SendAHigh Set PORTA.2 ON
#define SendALow Set PORTA.2 OFF
#define RecAHigh PORTA.0 ON
#define RecALow PORTA.0 OFF
InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
SerPrint 1, " PIC 12f1280"
SerSend 1, 13 ' "Carriage Return"
SerSend 1, 10 ' "Line Feed"
Start:
SerReceive 1, InChar 'wait for char from UART
SerSend 1, InChar 'send back char to UART
Goto Start