Ha ha some good ideas i like the comparator hack, i may have to try that as a test to see just if it is a level issue, as i would like to keep those pins free for the pwm.
Pic is 18f2550 so it has them, and I am running it at 5v, the phone/dsm module is 3v but 5v wont harm it.
I have tried input on both port b and C and tried with and without pullups enabled.
I will try the HW uart again with inverted as i am unsure of the stream polarity.
Heres the start of my code as a test etc and to show the configs I have
Code:
;DEFINE RESET_ORG 800h
;DEFINE INTERRUPT_ORG 808h
define OSC 48
;dEFINE LOADER_USED 1
; first four lines to fix broken pbp246
UIR VAR BYTE EXT
UIE VAR BYTE EXT
UEIE VAR BYTE EXT
UEIR VAR BYTE EXT
INCLUDE "MODEDEFS.BAS"
include "c:\dtusbsvc.pbp" ' would not know what to do without them !
' setup serial hardware comms
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h ; try 24 if errors
DEFINE HSER_BAUD 9600
DEFINE HSER_EVEN 1
DEFINE CHAR_PACING 1000 ' slow things a little
DEFINE HSER_CLOERR 1 ' automatic clear overrun error
' DEFINE HSER_SPBRG 25 ' let picbasic set it from the baud def above
DEFINE ADC_CLOCK 1
DEFINE ADC_BITS 8
DEFINE ADC_SAMPLEUS 10
ADCON1 = %10000011 ; not sure lol
CMCON = 7 ' Disable Comparators
INTCON2.7 = 0 ; should enable portb pullups.
TRISA = 3 ; configure AN0 an1 as an input
trisb = 255
trisc=255
tempx var byte ; temps..
tempy var byte ; temps..
loop:
hserout ["atd123",13,10]
for tempx=1 to 2 ; look for 2 chars from it for ''ok''
serin portb.7,n9600,10,tlable,tempy
tlable:
; gosub send tempy to usb to pc terminal
next
goto loop
Bookmarks