PE Lab apin question
SRLM
Posts: 5,045
I'm working through the PE labs with a demo board, and found this little issue. I noticed that if I change the two LED pins to {16, 20} then I get a faint light on LED pin 21 that parallels the action on pin 16. If I change the two LED pins to {16, 21}, then the same issue manifests itself, except the faint light is on LED pin 20. Same thing happens for any other pairs that I try. I suspect that this is due to some bit operation, but I don't know how/why.·Can anybody help?
''LedSweepWithSpr.spin ''PE Lab: Counters v0.8 Page 15 CON scale = 16_777_216 PUB TestDuty | apin, duty[noparse][[/noparse]2], module repeat module from 0 to 1 apin := lookupz(module: 16,20) ' I changed the values here <------- <-------- <--------- spr[noparse][[/noparse]8 + module] := (%00110 << 26) + apin dira[noparse][[/noparse]apin]~~ 'repeat duty sweep indefinately repeat repeat duty from 0 to 255 duty[noparse][[/noparse]1] := duty[noparse][[/noparse]0] * 2 repeat module from 0 to 1 spr[noparse][[/noparse]10 + module] := duty[noparse][[/noparse]module] * scale waitcnt(clkfreq/128 + cnt)
Comments
·
What you are seeing is normal behavior... If you look at the PDF here...
·
http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PropDemoDschem.pdf
·
...and you trace pins 20 and 21 you will see that they are shared with the VGA connector.
The LED's will get parasitic voltage through the 240 and 270 Ohms resistors if the I/O pins are left as inputs.
·
The same scenario is true for P18/P19, P20/P21, and P22/P23
·
To fix this or prevent this from happening on the demo board, simply make the LED pins all outputs. i.e.
·
change...
dira[noparse][[/noparse]apin]~~
·
...so that it reads...
dira[noparse][[/noparse]16..23]~~
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.