strange behavior... a bug?

yurif74

New Member
hi with 8 leds connected to the port B of a picaxe 28x2 i obitain a strange behavior..

look at this piece of code:

Code:
#slot 0
#no_data
#no_table

dirsb = %11111111

do

readadc 0,b0

debug b0

b0=b0/32 max 8
b2=1

if b0=0 then
	b2=1
	goto last
endif

for b1=1 to b0
	b2=b2*2
next

last:

pinsb=b2
loop
when it run on a picaxe with a trimmer on analog input 0 if i give all 5V (value 255) on pin 0 the led on PIN 7 of portB is on.
if i test it with the simulator and manually give the value of 255 all portB output are set to 0, included the PIN7!!!
that's strange! ehere is the problem? in the simulator or in the picaxe?
bye
 

hippy

Technical Support
Staff member
With a ReadAdc of 255, the Port B outputs should be B.7 on, B.6 through B.0 off. The PICAXE is behaving correctly.

This appears to be a problem with the Simulator and related to the division issue which has previously been identified and which we are working towards fixing.
 
Top