Program to test Mini ABB token error

Hi amigos:

I’m testing a Mini ABB with a BA 28 Pro microcontroller. When I create a new project and build the program to test it I get a token error about a comma on line 31. Does anyone have any idea what is wrong? Needless to say it never even makes it to load the chip. Here is the program and thanks amigos: -Migs

nn var byte

ledA var bit
ledB var bit
ledC var bit

butA var bit
butB var bit
butC var bit

prev_butA	var bit
prev_butB	var bit
prev_butC	var bit
temp	var	word

BUTTON_DOWN	con 0
BUTTON_UP	con 1

ledA = 0
ledB = 0
ledC = 0
butA = 0
butB = 0
butC = 0

nn = 0

'Wiggle LEDs
main:

adin ax0,2,ad_ron,temp
	serout S_OUT,i57600,[dec6 temp\6," ",13]


	if (butA = BUTTON_DOWN) AND (prev_butA = BUTTON_UP) then
		nn = nn + 1
		sound P9,[5\2500]
		low P9
	endif
	if (butB = BUTTON_DOWN) AND (prev_butB = BUTTON_UP) then
		nn = nn - 1
		sound P9,[10\1000]
		low P9
	endif
	if (butC = BUTTON_DOWN) AND (prev_butC = BUTTON_UP) then
		nn = 0
		sound P9,[10\4000]
		low P9
	endif
	
	ledA = nn.BIT0
	ledB = nn.BIT1
	ledC = nn.BIT2
	
	if ( nn.BIT0 = 1 ) then
		high p0
		high p8
		high p12
	else
		low p0
		low p8
		low p12
	endif
	if ( nn.BIT1 = 1 ) then
		high p1
		high p13
	else
		low p1
		low p13
	endif
	if ( nn.BIT2 = 1 ) then
		high p2
		high p10
		high p14
	else
		low p2
		low p10
		low p14
	endif
	if ( nn.BIT3 = 1 ) then
		high p3
		high p7
		high p11
		high p15
	else
		low p3
		low p7
		low p11
		low p15
	endif

	
	pause 50
	
	prev_butA = butA
	prev_butB = butB
	prev_butC = butC
	gosub button_led_control
	
goto main


'Subroutine to read the buttons and control the LEDs.  Button states are put in
'variables butA, butB, and butC.  LED states are read from variables ledA, ledB,
'and ledC.
button_led_control:
	'Make P4-P6 inputs to read buttons.  This turns the LEDs off briefly
	input p4
	input p5
	input p6
	butA = IN4
	butB = IN5
	butC = IN6
	
	'Output LOW to each LED that should be on
	if ledA = 1 then
		low p4
	endif
	if ledB = 1 then
		low p5
	endif
	if ledC = 1 then
		low p6
	endif
return

I notice that line 31 is:

adin ax0,2,ad_ron,temp

and that adin has two parameters:

Syntax
adin pin,var

In this case it has four.

What gives?

Thanks folks, -Migs

The Atom Pro has a different syntax for A to D. On page 150-151 in the Atom Pro manual you will see the command should be formatted like this.

adin pin,var

Hi Jim:

In my previous comment I made the same observation as you did. (less the manual’s page number.)

I took this program right off the Lynxmotion web site (It’s the program to test the ABB):

lynxmotion.com/images/files/abbtst01.bas

Could it be that it was posted on the site inadvertently with the error in line 31?

Migs

There isn’t anything wrong with the code, it’s just written for the Atom not the Atom Pro. I will make it more clear which program is for which processor and update the website. :wink:

Most of the sample programs that are up on the web site were written earlier for the Basic Atom chip not the Basic Atom Pro chip. While the two are reasonably compatible, there are some notable differences, which this is one of them…

Good Luck

Thanks Jim and Kurte.

Migs