Ok I found a way around to get my code to show up right, I could really use some help getting this to work.
I have a project that needs this interface and I want to get it running by the 28th before I get back home.
Code:
define OSC 4
DEFINE ADC_BITS 16 ' A/D number of bits
DEFINE ADC_CLOCK 3 ' Uses A/D internal RC clock
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in us
define HSER_BAUD 9600
DEFINE HSER_BITS 8
DEFINE HSER_CLROERR 1
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_SPBRG 25
DEFINE HSER_SPBRGH 0
A VAR WORD 'Stores 16 Bit Analog Reading
B VAR byte 'Temp Holder
Switch VAR PORTA.5 'Controls External FET or LED on pin 2
Switch = 0
mainloop:
ADCIN 2, A 'Grab analog input from Pin 3
Hserout [A] ' Send char out serial port
pause 100
HSERIN [B]
if B = 5 then switch = 1 else switch = 0
pause 100
goto mainloop ' Do it all over again
Last edited by wdmagic; - 23rd October 2015 at 02:10.
Chris
Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."
Bookmarks