In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bfranke wrote: Hi, I'm a newbie to Parallax and have been doing a crash course on the SX52. I downloaded Guenther Daubach's latest SXSim but that did not seem to help my problem. I'm not sure if it is a bug in the sim, or my programming. I tend to think the latter. Anyway, the problem I'm having is this: When I load port re with my final value, I then change the port direction back to input, but on the sim, re value doesn't change. It remembers the last value it had as an output. It remains different from the I/O panel settings for that port. I can "fix" the port settings by subsequently clicking the appropriate bits for that port on the I/O panel. Is this correct? Here is the code I have. It is not complete, this is just one routine located on the second page. cmd EQU $0A ;used in rx data and spi only - should be able to use as a temp buffer dat EQU $0B ; should be able to use as a temporary buffer with caution. bits EQU $0C ; some of these bits are available (2, 3, 5, 6, 7 - maybe 4, check spi) opa EQU $0D ; used in COMPSEND and Reada only opb EQU $0E opc EQU $0F org $00 BitCount EQU $1A ; this is the total bits. (35 max) BitPointer EQU $1B ; this is the bit pointer for each byte (8 max) FifoPointer EQU $1C ; this is the current byte FsrSave EQU $1D Temp EQU $1E ModeSave EQU $1F org $200 mov cmd,#5 ; load the counter mov dat,#5 ; always send the group that is complete, not the one currently in use. csb @FifoPointer,#5 ; skip if < 5 clr dat ; make zero mov w,#$1F mov m,w mov !re,#%00000000 ; Set port D to output direction so I can directly store in the register :loop mov w, #FIFO ; indirectly address the fifo add w,dat ; using the pointer (which is either 5 or 0) mov fsr,w ; point the FSR to the array item mov re, ind ; read the value from the fifo and put it on the bus :loop2 jb ra.2, :loop2 ; if buffer full then wait setb ra.1 ; clock data into buffer and send it away clrb ra.1 ; restore clock inc dat ; next byte dec cmd jnz :loop ; repeat 5 times mov re,@BitCount ; debugging only - need to know if all the bits are accounted for. :loop3 jb ra.2, :loop3 ; if buffer full then wait setb ra.1 ; clock data into buffer and send it away clrb ra.1 ; restore clock mov !re,#%11111111 ; Set port D back to input direction clr fsr ; restore the fsr jmp Main Thanks ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=114970 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)