Steve was controlling the A/D converter manually. So adding the ADC_ DEFINE's won't have any effect.
He was also getting a bit tricky (in a good way), so this might seem a little odd too.
Code:
' Do ADC conversion and save it to specific DataToSend array
' ----------------------------------------------------------
ADCON0.2=ADCON0.2 ^ 1 ' Switch between AN0 & AN1
PAUSEUS 10 ' arbitrary SamplingTime
GODONE=1 ' start conversion
WHILE GODONE : WEND ' wait 'till finish
; DATATOSEND[ADCON0.2]=(ADREAD>>2) ' save it to DataToSend array
DATATOSEND[ADCON0.2*2]=ADREAD.LowByte
DATATOSEND[ADCON0.2*2+1]=ADREAD.HighByte
'
' Read pushbutton status and save it to DataToSend array
' ------------------------------------------------------
datatosend[4] = PORTA.2
datatosend[5] = PORTA.3
datatosend[6] = PORTA.4
datatosend[7] = PORTA.5
; datatosend[6] = 0
; datatosend[7] = 0
With the above changes, the packet being sent will have AN0 in the first 2 bytes, 0 is the lowbyte.
AN1 is in bytes 2 and 3. and the pushbutton status is moved to bytes 4-7.
Hope you can move things easily on the VB side.
hth,
Bookmarks