I decided i am going to put relays instead of an H-bridge.
I recently obtained some nice sensors from Taosinc.com. I wrote this program but it does not work. The datasheet is not complicated, but maybe I missed something. I seems that i need to put SI to high after the 129th clock. maybe I am not using the pulsin command right.
datasheet:
http://www.taosinc.com/images/produc...401R-LF-E4.PDF
My program:
sensor var byte: counter var byte : pulse var byte
TRISB = %00000000
TRISA = %11111111
loop:
'clock input on RB0
'after 18 clock input at 1, count 111 clock cycles after the reset
pulse = 0
counting:
Pulsin PortA.1,1,pulse
pulse = pulse +1
if pulse = 18 then goto continue
goto counting
continue:
Pulsin PortA.1,1,pulse
pulse = pulse +1
if pulse = 130 then goto continue2
goto counting
continue2:
porb.0 = 1 'Si is now high
Pulsin PortA.1,1,pulse
pulse = pulse +1
if pulse = 131 then goto continue3
goto continue2
continue3:
ADCON0.2 = 1 'Start Conversion
porb.0 = 0 'put the SI back to zero
ADCIN 0, sensor 'Read channel PORTA.0
pause 50
Lcdout $fe, 1 'Clear screen
Lcdout "Sensor: ", Dec sensor
Pause 200
goto loop
end
I have bought the MCT6 chip (opto coupler)
I grounded pin 3 and 5
If I put a voltage a cross pin 4 should I get the same voltage across pin 6 ??
NO. here is a link to the data sheet'
http://www.fairchildsemi.com/ds/MC/MCT62.pdf
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I actually did the the circuit shown on page 5
http://www.ortodoxism.ro/datasheets/vishay/83645.pdf
still do not work.
Ok leramuer,
Since I am too lazy to read 288 pages of this post over, I am not going to ASSUME anything. So here goes; Current flow, not to be mistaken with electron flow, current flows from positive to negative. The arrows in LEDs and Transistors indicate the current flow direction. Maybe you know all this, like I said, I will assume nothing. (1) Anyway, if you have a pic which outputs logic High, then you hook that port to pin 1 or pin 4 of the opto coupler, and pins 2,3 would hook to ground.(2) If ypur PIC outputs logic low then you would hook the port to pin 2 or 3, pins 1 and 4 would hook to the positive supply. now if your relay has one leg hooked to positive then the other leg would hook to pin 6, or 7.
If your relay has one leg hooked to ground, then the other end should hook to pin 5 or eight. As I said current flows in the direction the arrows point. It is that simple. CAUTION: Be sure to use current limiting resistors on the emitter side of the opto couplers as they only operate at 1.5v max 20ma so as not to fry them.
Last edited by Archangel; - 26th January 2007 at 07:24.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
ok I am getting the voltage now
I will be using this to ativate my h-bridge.
also, I am trying to solder a small capacitor (0.1uF) on the terminal of my motor. The solder does not want to stay eith on the pin of the case of the motor, do you have any trick here?
Bookmarks