ADIN command does not return

Hello,

I am having problems using the ADIN command using the ‘Bot Board II’ with a ‘Basic Atom-28’ (NOT the pro) using the ‘BasicMicro ATOM IDE’. When I try to use the ADIN command it never returns to the main program. For example:

volts var word
low p14;turn on light
adin AX0,1,ad_ron, volts
high p14;turn off light
end

This program should turn on the orange light on the bot board, do an a/d conversion on pin AX0, then turn off the light. The behavior I get is an unwavering orange light. If I run the debugger, it will stay on the ADIN command till I reset it.

any help would be appreciated

You might want to use the actual pin number instead of using “AX0”. Try This:

volts var word 
low p14;turn on light 
adin p16,1,ad_ron, volts 
high p14;turn off light 
end

Now the results of ADin “volts” is not going to do anything but store the value in that variable unless you use the debug command to display the value.

Thanks SN96, but I’ve tried using p16 too and that doesn’t change anything.
(I know the example doesn’t do anything with the value put into volts, it just proved that it doesn’t get past adin)

I should also add that I’ve tried this on 3 new sets of botboards/basicatoms, so I hope it isn’t a hardware problem…

Another thing I tried was not using the adin command and manually setting the registers according to the PIC16F87x manual (page number 113 or page 115 in the pdf) but it never ‘completes’ the a/d conversion:

;Configure the A/D module
ADCON0 = %00000001	;fastest clock, channel 0, conversion not started, a/d turned on
ADCON1 = %10000000	;right justified with all the pins set to analog input

;Configure A/D interupt
PIR1 = PIR1 & %10111111	;clear ADIF
PIE1 = PIE1 | %01000000	;set ADIE
INTCON = INTCON | %11000000	;Set PEIE and GIE

;Wait the required acquisition time
pause 800 ;I think this enough time to wait

;Start conversion
ADCON0 = ADCON0 | %00000100;set the go/'not done' bit

;Wait for A/D conversion to complete
while ADCON0.bit2   ;repeats this loop forever
wend

;Read A/D result register pair
serout S_OUT, I8N1_9600, "high   : ",hex ADRESH, 13,"low    : ", hex ADRESL, 13]

;check the register status
serout S_OUT, I8N1_9600, "ADCON0 : ",sbin ADCON0, 13]
serout S_OUT, I8N1_9600, "ADCON1 : ",sbin ADCON1, 13]
serout S_OUT, I8N1_9600, "PIR1   : ",sbin PIR1, 13]
serout S_OUT, I8N1_9600, "PIE    : ",sbin PIE1, 13]
serout S_OUT, I8N1_9600, "INTCON : ",sbin INTCON, 13]

end

I don’t have a Basic Atom 28 to try. I don’t know why your program hangs on the AD command. the board should not have anything to do with the program not working. The bot board is almost like a breakout board for the Atom MCU. It never hurts to try anything and everything though.

Have you tried uninstalling the IDE from your computer and then re-install it? Was the AD command ever working before? I had problems with my Atom Pro ADin not reading the value but the program did not hang like yours. To fix my problem, I uninstalled the IDE and then did a fresh install and it fixed my problem. Since the IDE is hanging, there might be a slight chance that something went wrong with the app. Its worth a try anyway.

Pull the atom from the board and see if there is a Rev. D on the back of it. If so you must use a specific IDE for it. Go to the Basic Micro website to DL this IDE. Also please tell us which IDE you are currently using.

There are no "Rev. D"s on the back of the atoms.

I am currently using:

BasicMicro IDE 05.3.1.5
BasicMicro MBasic Compiler 05.3.1.5
BasicMicro Device DLL 01.3.1.5

I will ask Nathan to look at this post. I’m not sure what all the commands are that you are using. I never use anything except the simple adin command.

Look at the processor on the module. If it is a 16F886 chip then it is a rev D module which you have to specifically set in the chip selection dropdown of the IDE(and you should use the latest beta version of the IDE but I think you are already on that one). Also the ADIN syntax was changed to ADIN pin,variable. I suggest you uninstall all Atom softwarae and then reinstall the latest beta from the website. You should have gotten an error if you used the old syntax for ADin in 5.3.1.5. That leads me to think you may have installed over an older version of the IDE and some old files got left behind.

If you have a rev D module with a 16F88X chip on it the AD hardware is completely different from the older modules so youre manual code directly accessing old registers will not work correctly.

Success!!

After pealing back the BasicMicro sticker on the processor it revealed that it was a 16F886 chip. I switched to the “BasicATOM-28D” in the IDE (which I never tried since I didn’t have the telltale “Rev-D”) and ran the program again. This time it ran without a hitch and I was able to run another program that printed out the converted value and everything seemed to be working fine.

Thanks everyone for the help!

I am only using the processor number to determine the processor from now on. I see some early modules did not have the sticker attached. Glad you got it going!