Hi all, I'm trying the true mode, but my loopback setup is still not working.
Code:
'**************************************************************************
'*Program to test XRF radio communications via loopback method *
'*Uses a pushbutton switch on porta pin 4 *
'*Target processor is PIC 12f1822 *
'*207 program words, revised 05/07/2013 *
'*Program by Dick Ivers *
'*All rights reserved *
'**************************************************************************
'set 12f1822 configurat1on
#CONFIG
__config _CONFIG1, _FOSC_INTOSC & _MCLRE_OFF & _CLKOUTEN_OFF & _WDTE_ON
__config _CONFIG2, _PLLEN_OFF & _LVP_OFF
#endconfig
'set registers
OSCCON = %01111000 '16 mhz osc
OSCTUNE = 0 'factory calibration
ANSELA = 0 'all digital inputs
OPTION_REG.7 = 0 'global pullups enabled
WPUA = %010000 'porta pin 4 weak pullup enabled
CM1CON0.7 = 0 'comparator disabled
TRISA = %011110 'porta.0 & porta.5 are outputs, all others input
while OSCSTAT.0 = 0 'wait for stable freq.
wend
define OSC 16 '16 mhz oscillator
'Define debug parameters
DEFINE DEBUG_REGG PORTA 'set debug port to porta
DEFINE DEBUG_BIT 0 'use pin ra0 of porta for debug
DEFINE DEBUG_BAUD 9600 'set baud rate to 9600
DEFINE DEBUG_MODE 0 'communicate in true mode
DEFINE DEBUGIN_REGG PORTA 'set debug port to porta
DEFINE DEBUGIN_BIT 1 'use pin ra1 of porta for debugin
DEFINE DEBUGIN_BAUD 9600 'set baud rate to 9600
DEFINE DEBUGIN_MODE 0 'communicate in true mode
i var byte
char var byte
For i = 1 to 3
porta.5 = 0 'led on
pause 333
porta.5 = 1 'led off
pause 333
next
asleep:
nap 2 'delay 4 ms
if porta.4 = 1 then asleep
DT:
debug 55
debugin 100,blink,[char]
if char = 55 then
porta.5 = 0 'led on solid
goto halt
endif
blink:
porta.5 = 0 'led
pause 500
porta.5 = 1 'led off
pause 500
if porta.4 =1 then asleep
goto DT
halt:
stop 'led stays on
The communications not working. The led blinks when the remote transceiver is not powered, as it should. When its powered the program should branch to a solid on led , but no it keeps blinking. Any ideas?
Bookmarks