57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
' ########### start ###########
|
|
' pic:PIC18F4550
|
|
' ########### end ###########
|
|
|
|
; FILE: HardUART_18f4550.gcb
|
|
; DATE: 31.01.2015
|
|
; VERSION: 1.0a
|
|
; AUTHOR: Evan R. Venn based on works of others
|
|
;
|
|
; Description.
|
|
' A demonstration program for GCGB and GCB.
|
|
' Receive a char from Hardware-UART and send it back.
|
|
|
|
|
|
; This file is part of the Great Cow Basic compiler.
|
|
;
|
|
; This demonstration code is distributed in the hope that it will be useful,
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
; GNU General Public License for more details.
|
|
;
|
|
; ----- Configuration
|
|
|
|
#chip 18F4550, 1
|
|
|
|
|
|
; ----- Define Hardware settings
|
|
Dir PORTC.6 Out 'Tx = Pin 25
|
|
Dir PORTC.7 In 'Rx = Pin 26
|
|
|
|
|
|
'Config hardware UART
|
|
#define USART_BLOCKING
|
|
#define USART_BAUD_RATE 4800
|
|
|
|
'Invert UART data polarity to connect without max232:
|
|
Set TXCKP On 'inverted transmit data polarity
|
|
Set RXDTP On 'inverted receive data polarity
|
|
Wait 100 Ms
|
|
|
|
|
|
; ----- Variables
|
|
' No Variables specified in this example. All byte variables are defined upon use.
|
|
|
|
; ----- Main body of program commences here.
|
|
HSerPrint "18F4550"
|
|
HSerPrintCRLF
|
|
|
|
'Main routine
|
|
Start:
|
|
'wait for char from UART
|
|
HSerReceive InChar
|
|
'send back char to UART
|
|
HSerSend InChar
|
|
Goto Start
|
|
end
|