Reverse Command for 28X1 ?

MoonGoon

Member
Hi

I am needing the equivalent of the reverse command, but for the 28X1.
If it exists.
Iv hunted the manuals and couldnt find anything.

Is it possible to change an Output to an Input without using the dirsc command. In my case, this command wont help me.

I am wanting to test one of the portc pins if its LOW, if it is then make it an Input. But i need to do this individually of each of the other pins. As writing a binary dirsc command, each time my code loops, the pins i want to change to inputs will change aswell and the binary codes wont always be correct.

Any help out there please?
 

Dippy

Moderator
"I am wanting to test one of the portc pins if its LOW, if it is then make it an Input."

- Mmm.. the way you check/test to see if a pin is LOW (nom 0V from external circuit) requires you to have it as an 'input' in the first place. Sorry, I must have misread, cos i don't understand.

When hippy arises he can list the POKEs for you.
 

hippy

Ex-Staff (retired)
I am wanting to test one of the portc pins if its LOW, if it is then make it an Input. But i need to do this individually of each of the other pins. As writing a binary dirsc command, each time my code loops, the pins i want to change to inputs will change aswell and the binary codes wont always be correct.
I presume you mean when portc output pins are low you set as input, or you'll need it as an input to start with ? A little more detail on exactly what you want will help if I've mis-guessed.

Poking will be no different to setting DIRSC so you're going to have to keep track of what pins are input and outputs, perhaps something like ...

Code:
  Symbol copyOfDirsc = b13

  copyOfDirsc = $FF ' All outputs
  dirsc = copyOfDirsc
  Do
    :
    Gosub SetInputs
    :
  Loop

SetInputs:
  If outpin0 = 0 Then : copyOfDirsc = copyOfDirsc & %11111110 : End IF
  If outpin1 = 0 Then : copyOfDirsc = copyOfDirsc & %11111101 : End IF
  If outpin2 = 0 Then : copyOfDirsc = copyOfDirsc & %11111011 : End IF
  If outpin3 = 0 Then : copyOfDirsc = copyOfDirsc & %11110111 : End IF
  If outpin4 = 0 Then : copyOfDirsc = copyOfDirsc & %11101111 : End IF
  If outpin5 = 0 Then : copyOfDirsc = copyOfDirsc & %11011111 : End IF
  If outpin6 = 0 Then : copyOfDirsc = copyOfDirsc & %10111111 : End IF
  If outpin7 = 0 Then : copyOfDirsc = copyOfDirsc & %01111111 : End IF
  dirsc = copyOfDirsc
  Return
 
Last edited:

MoonGoon

Member
Sorry i wasnt clear on that.

Yes, i want to test if an output is LOW and if so make only that pin an Input.
I cant use the dirsc command.

Im sorry but what is the " copyofdirsc " command ?
Iv never seen that before, its not in my manual.

But the sample code "if" statements change the first pinO ok, but then the next "If" statement then changes the pin back to an Output. I need the Pin0, if it changed to an Input, to stay as in Input while the other If statements change their inputs, if valid.

Sorry, im not sure if iv made my situation clear or not.

Is there an equivalent of the "Reverse" command for the 28X1 ??
 

hippy

Ex-Staff (retired)
Sorry I wasn't clear either - "copyOfDirsc" is a variable. The code should work ( I've edited it so syntax is now correct, ie = not := ).

When outpin0 is low it will set bit 0 of copyOfDirsc low ( input ) and that should stay that way forever. The second IF won't affect that bit because it's a bit-wise AND, ie it only clears bits which are 0 in the %... value.
 
Top