OUT() in ARMbasic [9.37m]

Questions about the BASICtools and MakeItC
Post Reply
olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

OUT() in ARMbasic [9.37m]

Post by olzeke51 »

Trying to use the DIP800 in an OEM pcb. Ran into problems with control signals not toggling.
'
1)Loading and running this short program indicates that OUT() doesn't work UNTIL IO() has run !!!

Code: Select all

dim x, p

'
''  I/O RUNS thru (28)
'These are the AD0 - AD7  (add/data) pins
OUTPUT(16)			'GREEN LED
OUTPUT(17)			'BLUE LED

'
Main:
'
PRINT "TESTING pins with OUT() command"
for x =5  downto p
	OUT(16)= 1		'GREEN LED
	OUT(17)=1	'BLUE LED
wait(400)
	OUT(16)= 0		'GREEN LED
	OUT(17)=0	'BLUE LED
wait(400)
	print x
next
'
print "alternate flashing with IO() command"
p = 0
for x =5  downto p
	IO(16)= 1		'GREEN LED
	IO(17)=1	'BLUE LED
wait(400)
	IO(16)= 0		'GREEN LED
	IO(17)=0	'BLUE LED
wait(400)
	print x
next
'
PRINT "TESTING pins with OUT() command after IO()command"
for x =5  downto p
	OUT(16)= 1		'GREEN LED
	OUT(17)=1	'BLUE LED
wait(400)
	OUT(16)= 0		'GREEN LED
	OUT(17)=0	'BLUE LED
wait(400)
	print x
next

end
'
current_sw_800DIP.jpg
current_sw_800DIP.jpg (23.56 KiB) Viewed 6294 times
Attachments
BLINKY-824out.bas
(764 Bytes) Downloaded 239 times



olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: OUT() in ARMbasic [9.37m]

Post by olzeke51 »

RESOLVED......
'
the pin configuration needs to be in the 'Main:' routine .... NOT before it.
'
FWIW - a 'label:' routine needs a RETURN , not an ENDSUB to close it out......
'
Shouldn't have taken summer off (for gardening) from programming.
This shot a hole in my afternoon!!!
Gary Z
resolved.jpg
resolved.jpg (40.76 KiB) Viewed 6290 times

basicchip
Posts: 1029
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: OUT() in ARMbasic [9.37m]

Post by basicchip »

Yes inline execution begins at MAIN: if it exists. The compiler currently warns about inline execution of SUB/ FUNC if there is no MAIN. I will look into a possible warning on OUTPUT and the like.

In my code examples you will often see simple integer expressions, which I use to declare global integers. I am kind of old school BASIC where DIM are not required for integers. if you like to force the DIM requirement, then declare an integer by DIM early in the program, after that all integers must be declared by DIM.

The advantage of declaring all integers, is that the compiler will then flag mis-spelled variable names rather than assuming they are integers.

Post Reply