Posted By
Devlin on 2007-11-11 20:50:24
| +4 UserPort
Hi I would like to turn on/off +5V on the user port. I understand ground is negitive wire. So for the positive wire what pins can be hooked up and what is the pokes to turn on/off +5VDC? I see here on a chart there is P0 to P7 as Data.
I used to turn on off relay switches with PB0 thorugh PB7 on a Vic 20 to power on/off low voltage micro realy switches with a Vic 20
Can this be done on the plus/4? I would like 8 sources for 8 diffrent relays.
|
|
Posted By
IstvanV on 2007-11-12 05:47:21
| Re: +4 UserPort
The user port is at $FD10. Note that bit 2 is also used for sensing the datassette button state, when a button is pressed, it goes low.
|
|
Posted By
Devlin on 2007-11-12 17:43:51
| Re: +4 UserPort
Thanks for the user port address. But do you have the Pokes to set userport to all output and the pokes to turn on/off P0 through P7?
|
|
|
Posted By
Devlin on 2007-11-14 01:45:39
| Re: +4 UserPort
Ok so now I know $fd10 bit 0 is p0. How do I make it output to get 4.5VDC? on p0?
|
|
Posted By
Devlin on 2007-11-14 01:56:19
| Re: +4 UserPort
Please someone tell me how this can work I know about Monitor + Return Once in tedmon what do I type in to get 4.5 volts output on P0 through P7 Or just tell me what to type in just for P0 then P1 ect ect all I need is a few baby steps I am new to this. Need help here
|
|
Posted By
IstvanV on 2007-11-14 05:40:59
| Re: +4 UserPort
You cannot control if the lines are input or output, since they are always both. Basically, for each line there is a pull-up resistor connected to +5V, and a transistor pulls the output down when it should be 0V. The output current is low, so you may want to buffer it rather than driving relays etc. directly. For input, you would use a 7406 or similar open collector device. A few simple examples of controlling the user port from the monitor:
>FD10 FF makes all lines high (+5V) >FD10 00 all are low (0V) >FD10 01 P0 is high, all others are low >FD10 80 P7 is high, all others are low
|
|
Posted By
IstvanV on 2007-11-14 06:02:10
| Re: +4 UserPort
Of course, to use a bit as input, you need to write "1" to it, otherwise it would always be low.
|
|
Posted By
Devlin on 2007-11-17 18:33:42
| Re: +4 UserPort
Ok
FD10 01 P0 is high all low FD10 80 P7 is high all low
Can I have the rest like above but for P1 through P6?
Thanks
|
|
Posted By
Devlin on 2007-12-12 16:16:04
| Re: +4 UserPort
Anyone know this? Please Help.
|
|
Posted By
IstvanV on 2007-12-13 07:13:46
| Re: +4 UserPort
As explained earlier, each bit of the value written to FD10 (or 64784 in decimal) corresponds to a line of the user port, and there is no data direction register.
|
|
Posted By
DeadTED on 2007-12-28 19:32:17
| Re: +4 UserPort
Hello the sample program below will switch bits on
A1000 LDA $FD10 -- Address of 6529 AND #$00 -- Turn all bits off, set low ~0V STA $FD10 -- store value LDA $FD10 ORA #$01 -- switch bit 1 on STA $FD10 LDA $FD10 ORA #$02 -- switch bit 2 on STA $FD10 BRK
By the way this can all be done in basic as well.
1 A=PEEK(DEC("FD10")):REM read port state first 2 A=A OR 1:REM SET BIT 0 3 A=A AND 253: REM clear bit 1 note 253=%1111101 4 A=A OR DEC("F0"): REM set bits 7-4 to be used for input F0=%11110000 5 POKE DEC("FD10"),A
Program courtesy of Christian (Solder), this guy is a legend! not to mention a genius when it comes to +4 hardware hacking. Note it is best to first decide which pins you want to use as inputs and which as outputs. ie, you may want to use bits 7-4 as inputs and 3-0 as outputs. This is important so you do not damage the 6529 chip.
I have previously developed extensive basic programs to control relay boards and read inputs on the +4, I will post if I find them.
I am now also trying to interface a 6522 VIA chip to increase the inputs and outputs available.
Also, always use a driver like the uln2803 chip to drive your outputs and if you can opto isolate your inputs, just helps protect the +4.
|
|