64 lines
1.8 KiB
Plaintext
64 lines
1.8 KiB
Plaintext
' ########### start ###########
|
|
' pic:PIC16F1786
|
|
' ########### end ###########
|
|
|
|
; FILE: MixUART_16f1786.gcb.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 Software-UART and send it back using Hardware-UART.
|
|
|
|
|
|
; 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 16f1786, 4
|
|
|
|
; ----- Define Hardware settings
|
|
' see uart for critical port settings
|
|
|
|
|
|
'Config Hardware-UART to send with
|
|
#define USART_BAUD_RATE 2400
|
|
#define USART_BLOCKING
|
|
'Invert UART Tx polarity to connect without max232
|
|
Set SCKP ON
|
|
'Set UART transmit pin to output (Tx)
|
|
Dir PORTC.6 Out 'Pin 17
|
|
|
|
'Config Software-UART to receive with
|
|
#define RecAHigh PORTB.7 ON
|
|
#define RecALow PORTB.7 OFF
|
|
InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
|
|
'Set the pin direction
|
|
Dir PORTB.7 In 'receive on Pin 40 (RB7/PGD)
|
|
Wait 100 Ms
|
|
|
|
|
|
; ----- Variables
|
|
' No Variables specified in this example. All byte variables are defined upon use.
|
|
|
|
; ----- Main body of program commences here.
|
|
'Message after reset
|
|
HSerPrint " PIC 16f1786"
|
|
HSerSend 13 ' "Carriage Return"
|
|
HSerSend 10 ' "Line Feed"
|
|
|
|
Start:
|
|
SerReceive 1, InChar 'wait for char from Software-UART
|
|
HSerSend InChar 'send back char to Hardware-UART
|
|
Goto Start
|
|
|
|
|
|
|
|
|