Relay Outputs

I am new at this PBASIC language (although very experienced in VB), and I have a question about the output command. In this line:

[FONT=courier new] Serout USERCPU, OUTBAUD, [255,255,PWM1,relayA,PWM2,relayB,p3_y,p4_y,p1_x,p2_x,p3_x,p4_x,p1_wheel,p2_wheel,p3_wheel,p4_wheel,127,127,127,127]FONT]

as far as I can tell, I can only use Relay ports A and B. I need to use 4 of the ports, at least. Where do I put the specified outputs in the Serout command? Or does that happen anywhere else?

Thanks

The Relay A and B should include all the assorted relays. You don’t need to list them individually.
I’m not sure if that answers your question, but i hope it does

relayA VAR byte
relayB VAR byte
… (later in program)
relay1_fwd VAR RelayA.bit0
relay1_rev VAR RelayA.bit1
relay2_fwd VAR RelayA.bit2
relay2_rev VAR RelayA.bit3
relay3_fwd VAR RelayA.bit4
relay3_rev VAR RelayA.bit5
relay4_fwd VAR RelayA.bit6
relay4_rev VAR RelayA.bit7
relay5_fwd VAR RelayB.bit0
relay5_rev VAR RelayB.bit1
relay6_fwd VAR RelayB.bit2
relay6_rev VAR RelayB.bit3
relay7_fwd VAR RelayB.bit4
relay7_rev VAR RelayB.bit5
relay8_fwd VAR RelayB.bit6
relay8_rev VAR RelayB.bit7

basically what this means is that relays 1 through 4 are the 8 bits in relayA. relays 5 through 8 are the 8 bits in relayB. This isn’t something that should concern you to badly. The important part is…
relay1_fwd = p1_sw_trig &~ rc_sw1 'Port 1 Trigger = Relay 1 Forward 'Relay 1 wont go Forward if rc_sw1 is ON
relay1_rev = p1_sw_top &~ rc_sw2 'Port 1 Thumb = Relay 1 Reverse 'Relay 1 wont go Reverse if rc_sw2 is ON
relay2_fwd = p2_sw_trig &~ rc_sw3 'Port 2 Trigger = Relay 2 Forward 'Relay 2 wont go Forward if rc_sw3 is ON
relay2_rev = p2_sw_top &~ rc_sw4 'Port 2 Thumb = Relay 2 Reverse 'Relay 2 wont go Reverse if rc_sw4 is ON
relay3_fwd = p3_sw_trig 'Port 3 Trigger = Relay 3 Forward
relay3_rev = p3_sw_top 'Port 3 Thumb = Relay 3 Reverse
relay4_fwd = p4_sw_trig 'Port 4 Trigger = Relay 4 Forward
relay4_rev = p4_sw_top 'Port 4 Thumb = Relay 4 Reverse

relay5_fwd = p1_sw_aux1 'Port 1 Aux1 = Relay 5 Forward
relay5_rev = p1_sw_aux2 'Port 1 Aux2 = Relay 5 Forward
relay6_fwd = p3_sw_aux1 'Port 3 Aux1 = Relay 6 Forward
relay6_rev = p3_sw_aux2 'Port 3 Aux2 = Relay 6 Forward
relay7_fwd = p4_sw_aux1 'Port 4 Aux1 = Relay 7 Forward
relay7_rev = p4_sw_aux2 'Port 4 Aux2 = Relay 7 Reverse
relay8_fwd = 1 'Relay 8 always Forward
relay8_rev = 0 'Relay 8 always Forward

Ah Ha! Now I understand how that works. Thanks a lot for pointing out what was right in front of me.

Thanks a ton

  • “My pappy was a pistol so I am a son of a gun!”