Re: Beginning USB How to/Whats needed to use it.
just an example of code that I am starting with
Code:
'* Notes : Using 18F4550 *
'* : *
'****************************************************************
DEFINE ADC_BITS 10 ' A/D number of bits
DEFINE ADC_CLOCK 1 ' Use A/D internal RC clock
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in us
TRISA = 1 ' PORTA.0 is Analog Input
TRISB = 0 ' PORTB is Output
Analog VAR WORD ' Stores the 16bit Result from ADC0
UnitON VAR Bit ' Stores the state that output should be
UnitON = 0 ' Initial state
MainLoop:
ADCIN 0, Analog ' Saves 16bit Analog reading to Variable
'Code for sending Analog reading to PC
'Code for receiving the state needed to send to output port.
PORTB.0 = UnitON
pause 100
goto mainloop
END
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