SX48 proto board and Pull ups
Good Morning,
I am just a little frustrated with my SX-48 Proto board and or my software not sure which.· I am trying to read an 8position dip switch in port e.· The switch is connected to VSS on one side and thru 270 ohm resistors to RE.· Using the following commands to load port and read:
port e latch $00
Port e DDIR· $FF
Port e PLP·· $00
The commands to load are:
_mode· ST
mov w#RE_ST
Mov !RE,W
_mode LVL
mov W,#RE_LVL
mov !RE,W
_mode PLP
mov w,#PLP
mov !RE,w
_mode DDIR
mov w,#DDIR_E
mov !RE,w
_mode latch
mov w,#RE_latch
mov !RE,w
mov __WPARAM12_LSB,DIP_1
I see nothing in W during the transfer when I breakpoint in DEBUG
where am I going wrong?
I also am having a problem with SXSIM in that I cannot keep the Commands desplaying after I load the lst file.
Thanks for the help
I am just a little frustrated with my SX-48 Proto board and or my software not sure which.· I am trying to read an 8position dip switch in port e.· The switch is connected to VSS on one side and thru 270 ohm resistors to RE.· Using the following commands to load port and read:
port e latch $00
Port e DDIR· $FF
Port e PLP·· $00
The commands to load are:
_mode· ST
mov w#RE_ST
Mov !RE,W
_mode LVL
mov W,#RE_LVL
mov !RE,W
_mode PLP
mov w,#PLP
mov !RE,w
_mode DDIR
mov w,#DDIR_E
mov !RE,w
_mode latch
mov w,#RE_latch
mov !RE,w
mov __WPARAM12_LSB,DIP_1
I see nothing in W during the transfer when I breakpoint in DEBUG
where am I going wrong?
I also am having a problem with SXSIM in that I cannot keep the Commands desplaying after I load the lst file.
Thanks for the help
Comments
In theory you have everything correct. The code snipet you have posted doesn't help at all.
Try to reduce the program to the least amount of code that still exhibits the problem.
Then post the entire code so we can try it and see if we can reproduce the issue.
I have found when doing this, many times I find the problem myself in the process.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson
"It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter
www.iElectronicDesigns.com
·
- Sparks
The test file is attached.
Thanks
Jim
Using the snipit of code I posted the other day, I run the program fine under SX-Sim. It does as I expect. However, when I run it on a protoboard, I get all 0 all the time on RE. I grabbed a brand new proto board, after implementing strict ESD measures and installed a single 270 ohm resistor from RE 5 to VSS. I would expect to see all 1 except a 0 in RE.5. Where do I go from here?
Jim
[noparse][[/noparse]Disregard the LED ckt on the side.· And "P1" would be your SX input pin.]
I just connected a resister to VDD and I get a 1.· It appears that the PLP is not working on my 2 proto boards.· I have a third that I will try it on and then contact Parallax regarding the problem.
Thanks everyone for all the help.· I will revisit my design and see if I can use VDD instead of VSS and use the external pullup
JIM
I have done a couple of things this morning with interesting results.· I commeneted out the RD and RE parts of the code and tried running same code on my SX-28.· No Pullup present. Yet when I run the same code on sx-sim I see all 1's on all inputs with nothing connected.· I also used the same code on all ports to set them all to inputs with pullup. No port is responding.· Is the problem the order in which the code is being fed to the mode register?· I would not think so but....
As far as using external pullup, that increases my parts count far more than I would like!
I am scratching my head and with little hair that is hazerdous to my scalp!
Jim
I found the problem!· The macro that sets the mode failed to have the constant value as part of the macro!
it read:
\_mode· Macro·1
\mov w,\1
It should have read mov· w,#\1
Gunther warned about the sleepless nights that failing to declare a value a constant·would cause, well it did!
Thanks for all the inputs and suggestions, maybe now I can get on with my project.
Jim