Serin serout problem - Page 8


Closed Thread
Page 8 of 9 FirstFirst ... 456789 LastLast
Results 281 to 320 of 337
  1. #281
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok, i need to draw it
    any software has a 40 pin chip ?

  2. #282
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    the output of the microcontroller is hooked up to the enable of the h-bridge, how can that fry my pins. I just fried my ccp pin..
    Under normal circumstances, it shouldnt.

    Having said that, you have already destroyed on H-Bridge which is being fed from your 12V supply. When that chip died it is possible that the 12v supply got fed back to your PIC.

    One phone system that I used to work on had ULN2803 drivers for the relays. The phone system CPU was running on a 5v power supply but the relays were running off 47v. When systems were hit by lightning the power supply would normally die and sometimes the ULN2803s would be damaged. If you didnt find the damaged ones and replace them they would fail shortly after the system was powered up and stuff the 47v supply into the CPU killing it and the new PSU

    I think you need to read up more on the basics of electronics as to date in this thread you have

    Toasted an LCD
    Cooked an H-Bridge
    Fried a PIC

    .... maybe a job in the catering trade would be more suitable based on the above

    A picture is worth a thousand words so as Skimask suggested, a look at your schematic may give us the chance to help you resolve your problems. We have all been down the road of killing components, its how you build up experience. Expensive but it forces you to learn quickly !!!!
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #283
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    as for the lCd that is entirely my fault,

    but are you saying opto couplers are not necessary?
    when should they be used. ?
    i just read a few reports of similar problem that where resolved this way.
    pic:
    http://www3.sympatico.ca/lerameur/PDR_0141.jpg

  4. #284
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    as for the lCd that is entirely my fault,

    but are you saying opto couplers are not necessary?
    when should they be used. ?
    i just read a few reports of similar problem that where resolved this way.
    pic:
    http://www3.sympatico.ca/lerameur/PDR_0141.jpg
    Sorry guy...I can't make heads or tails of the picture in your last post.

  5. #285
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    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

  6. #286
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default opto coupler

    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 ??

  7. #287
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    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.

  8. #288
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I actually did the the circuit shown on page 5

    http://www.ortodoxism.ro/datasheets/vishay/83645.pdf

    still do not work.

  9. #289
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Step by step

    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.

  10. #290
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    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?

  11. #291
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Pins

    also,
    I dont usually use that and/or have seen this, but should we put resistors to ALL output pins of the microcontroller?
    Last edited by lerameur; - 26th January 2007 at 11:27.

  12. #292
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default pins

    Quote Originally Posted by lerameur View Post
    also,
    I dont usually use that and/or have seen this, but should we put resistors to ALL output pins of the microcontroller?
    When I used the word pin, I meant the literal piece of metal sticking out of the part. I guess I should have said leads.
    The opto coupler is made from 2 LEDs, 2 photo transistors. So in a word, Yes all the opto couplers LEDs should have series resistors.
    As far as your PIC goes, I (personally) never leave pins floating out in space, I always tie them to Power or Ground as appropriate to their respective conditions.
    I hope you found this to be of value.
    JS
    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.

  13. #293
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    so you are saying that you do put a resistor between the pin and anything that is connecet right, like an h-bridge or another microcontroller right

  14. #294
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default not always

    Quote Originally Posted by lerameur View Post
    so you are saying that you do put a resistor between the pin and anything that is connecet right, like an h-bridge or another microcontroller right
    The pic outputs are matched to TTL levels, you can connect them directly to 5 volt logic devices without resistors.
    A resistor is used anytime you need to limit the current to keep from smoking your PIC. look at the data sheet and see what the output ports can source or sink. What is the load you are putting on it? A 16f628A can sink or source 25 ma on each I/O pin and keep in the magic smoke. a resistor may be required in series to keep the current below the magic 25ma. In the case of these opto couplers a resistor is definately needed.
    So looking at the DATA sheet from the opto coupler, the diode operates on 1.25 volts at 20ma. If you are using a 5 volt supply then the formula is :
    5v - 1.25 v / .02 = 187.5 ohm so round up the closest say 200 ohm resistor and you are golden.
    Last edited by Archangel; - 28th January 2007 at 08:43. Reason: Add
    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.

  15. #295
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok I am continuing my project.
    I get a compiling error for my If then loop:
    If I hide the two last line , then I dont get any error. But I need those lines. Any ideas?

    if portb.0 = 1 then goto Option1
    if portb.1 = 1 then goto Option2
    if portb.2 = 1 then goto Option3
    if portb.3 = 1 then goto stopping
    else goto stopping
    endif


    error:
    C:\PBP\MOTORG.BAS ERROR Line 62: Syntax error.
    C:\PBP\MOTORG.BAS ERROR Line 63: ENDIF without a matching IF..THEN.
    C:\PBP>

  16. #296
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    Ok I am continuing my project.
    I get a compiling error for my If then loop:
    If I hide the two last line , then I dont get any error. But I need those lines. Any ideas?

    if portb.0 = 1 then goto Option1
    if portb.1 = 1 then goto Option2
    if portb.2 = 1 then goto Option3
    if portb.3 = 1 then goto stopping
    else goto stopping
    endif


    error:
    C:\PBP\MOTORG.BAS ERROR Line 62: Syntax error.
    C:\PBP\MOTORG.BAS ERROR Line 63: ENDIF without a matching IF..THEN.
    C:\PBP>
    if portb.3 = 1 then
    goto stopping
    else
    goto stopping
    endif

    You can't have that first 'goto stopping' on the same line as the if/then if you're using an if/then/else type statement

  17. #297
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    HI,
    hope you are doing good.
    I read a thread on this site concerning the 7805 overheating.
    My 7805 is overheating even with a heat sink and I just have a LCD a pic chip and a RF receiving module. I tried the tricks they say but none is working.
    I tried conencting the backlight directly to the 12v battery using a 150 IOhm resistor, or t o the 5V output of the 7805 with a 22 ohm resistor. Whils always keeping the LCD Vdd to the 5v of the 7805.
    It heats op in every case ?
    any ideas ?
    Lcd 16 x2: UNIQ/eVision GC-1602I1
    Last edited by lerameur; - 2nd February 2007 at 00:04.

  18. #298
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    HI,
    hope you are doing good.
    I read a thread on this site concerning the 7805 overheating.
    My 7805 is overheating even with a heat sink and I just have a LCD a pic chip and a RF receiving module. I tried the tricks they say but none is working.
    I tried conencting the backlight directly to the 12v battery using a 150 IOhm resistor, or t o the 5V output of the 7805 with a 22 ohm resistor. Whils always keeping the LCD Vdd to the 5v of the 7805.
    It heats op in every case ?
    any ideas ?
    Lcd 16 x2: UNIQ/eVision GC-1602I1
    What is your input voltage to the 7805? 12v?
    What do you mean by 'overheating'? It's actually overheating and shutting down or just getting hot?
    Put a meter across the 5v and ground lines at their input to the board. What does it read when using the resistance setting? What does it read when using the diode-check (continuity) setting?

    This should help get it narrowed down...

  19. #299
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    It is 12v
    I am getting .22amp It is getting very hot, but not shutting down.
    Should I put a bigger heat sink or maybe two Lm7805 ?

  20. #300
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    It is 12v
    I am getting .22amp It is getting very hot, but not shutting down.
    Should I put a bigger heat sink or maybe two Lm7805 ?
    Here's a bit of math for ya...
    12v input @ .22 amp = 2.64 watts total
    5v output, drawing .22 amp = 1.1 watt.
    (don't know if you're familiar with this stuff yet)

    The regulator has to 'dump' 7v @ .22amp, which is 1.54 watts. That doesn't seem like a lot, but it's enough to make the 7805 hot, even if you've got a heat sink on it.

    Do you have any heat sink compound between the 7805 and the heat sink face itself?

    (oh...and .22amp for your configuration sounds about right)

  21. #301
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    HI,
    hope you are doing good.
    I read a thread on this site concerning the 7805 overheating.
    My 7805 is overheating even with a heat sink and I just have a LCD a pic chip and a RF receiving module. I tried the tricks they say but none is working.
    I tried conencting the backlight directly to the 12v battery using a 150 IOhm resistor, or t o the 5V output of the 7805 with a 22 ohm resistor. Whils always keeping the LCD Vdd to the 5v of the 7805.
    It heats op in every case ?
    any ideas ?
    Lcd 16 x2: UNIQ/eVision GC-1602I1

    Hi Ken,
    Here are some figures for you to "SMOKE OVER" pun intended.
    you need to add up the current draw of all of your outputs, and other loads and make sure you are not overloading your 7805 and your PIC. OR hook your DVM in series on the amp scale.
    LED @ 4 volts at 45 ma hooked to 5 volt = 22 ohm
    LED @ 4 volts at 20 ma hooked to 5 volt = 50 ohm
    LED @ 5 volts at 20ma hooked to 12v =350 ohm
    LED @ 5 volts at 40ma hooked to 12v = 140 ohm
    LED @ 4 volts at 20 ma hooked to 12 volts = 400 ohms
    LED @ 4 volts at 40 ma hooked to 12 volts = 200 ohms
    the formula is still Rs = Vin - V led / I led. Where V in is input voltage, V led is led voltage and I led is LED current in ma.
    Hope this is helpful.
    JS
    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.

  22. #302
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    well because i still need all of these components. Its drawing way too much. 1.1 a out of 1amp max.

    what about putting 2 Lm7805 in parallel?
    Last edited by lerameur; - 2nd February 2007 at 01:28.

  23. #303
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default dual supply

    Quote Originally Posted by lerameur View Post
    well because i still need all of these components. Its drawing way too much.
    what about putting 2 Lm7805 in parallel?
    Honestly Ken,
    I do not know if that works or not, That is a linear IC and I am not too sure how they will interact. I think a better solution would be to use a bigger regulator IC, or use 2 or more 7805s as seperate supplies using a common ground. Your pic can sink current from the secondary supply, and your display could also run from it. Note: check the data sheet for maximum current the pic can handle in total, so as not to exceed.
    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.

  24. #304
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    well because i still need all of these components. Its drawing way too much. 1.1 a out of 1amp max.

    what about putting 2 Lm7805 in parallel?
    You just said you were drawing .22amp...
    Which one is it? 1.1 a or .22 a ?

  25. #305
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    sorry 1.1watt
    These babies can draw 1amp, why cant I draw more then .22 without being very hot ?
    I dont see the wattage value on the spec sheet of this chip,
    Last edited by lerameur; - 2nd February 2007 at 02:02.

  26. #306
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    sorry 1.1watt
    These babies can draw 1amp, why cant I draw more then .22 without being very hot ?
    I dont see the wattage value on the spec sheet of this chip,
    There's a wattage value buried in the 7805 datasheet somewhere. And remember, your circuit is drawing 1.1 watt, but your regulator is dissipating 1.54watt, and you are drawing 2.64watts from your battery total.

    The amount of temperature rise on the back of the 7805/heatsink/whatever, is directly related to the ability of that 'place' to dissipate heat.
    If you've got something that just doesn't give up heat, it'll get hot...if it's very conductive, it'll stay cool.
    So, with that being said, even 1 watt can feel very hot depending on what the heatsink is, if there is any heat conductive compound in between the 7805 and the heatsink, ambient temperature, etc.etc.

    Think about it this way....take a 40 watt light bulb... It's hot right? All the way around it. It's also pretty big when compared to a 7805 with a heatsink. Now, take that same 40 watt bulb, shrink it 40 times, and apply 1/40th of the heat...sounds like it might be in that same ballpark. Obviously I don't know what the actual numbers would be, I'm generalizing quite a bit, I think it sounds reasonable.

    And take another look at what I was saying earlier about how much power the regulator has to dissipate. Do you understand that much of it? (As in why the regulator dissipates 1.54watt when you power it with 12v and only draw .22amp from the regulator?) Remember, a linear regulator, such as a 7805, regulator by dumping extra voltage off as heat...that's the way they work (in simple terms anyways)...kinda like an infinetely variable power resistor that's always turning itself to keep the output voltage at a certain point.

  27. #307
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    well it dissipates 1.54watt because it can take 1watt , so 2.54 watt total from the battery. I guess I need this part: L78S05CV for now

  28. #308
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    well it dissipates 1.54watt because it can take 1watt , so 2.54 watt total from the battery. I guess I need this part: L78S05CV for now
    You could 'preregulate' the 12v input with either another regulator ( 12v -> 7809 -> 7805), maybe a few diodes in series, etc.etc. Knock the voltage down a bit before doing the final regulation to 5v. That'll cut down on your heat.

    What package is this 7805 that you have right now? TO-92? TO-220?

  29. #309
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    it is TO-220,
    by the way I once saw a sheet with all the packages types on the digi key web site, I cant seem to find it anymore. Would you have a similar sheet?
    But instead of using 7809 and 7805, I think I will use a 2amp or maybe a 3 amp regulator it wont cost more.
    k

  30. #310
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    it is TO-220,
    by the way I once saw a sheet with all the packages types on the digi key web site, I cant seem to find it anymore. Would you have a similar sheet?
    But instead of using 7809 and 7805, I think I will use a 2amp or maybe a 3 amp regulator it wont cost more.
    k
    If you pull up a search on digikey for 'regulator', 'fixed', '5v', it should be able to show you pretty much all of the packages they have available.

    Quite frankly, there's got to be something else going on. 1 watt on a TO-220 7805 isn't that much...and again, quite frankly, if the regulator isn't shutting down, I don't think it's getting too hot to worry about. The datasheet I've got for the TO-220 case shows a temp rise of 65C/watt without a heatseak (junction to air) and a max operating temp of +125C. That tells me that something just short of 2watts is safe. You're dumping 1.54watts, 1.54 x 65 = 100C. That's hot, but not really that HOT...especially if you've got a heat sink on it which will really drop that 65C/watt number to something more normal-ish.

    In short, as long as it's not shutting down, you're good. If you're still worried about it, pull down a few datasheets and have a look at a thing called an 'external pass transistor'. Basically, you use the regulator to control the base of an external transistor which bypasses just enough juice to keep the regulator working and to basically do all the work for the regulator.

    If not that, go ahead and parallel a couple of 7805's. Just keep in mind that 7805-A might be set at a slightly higher voltage than 7805-B, so you need to put a small value/high wattage series resistor inline with each output, or in bad cases, you'll have to isolate each regulator's output from each other with an inline diode.

    Try it out...you won't hurt anything. At worst, they'll overheat and shut themselves off until they cool off...

  31. #311
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Every whichaway

    Hi Ken,
    I'm looking at your pictures and I have to ask, are you sure you have that regulator plugged in right, because if it's backwards it will still work (kinda) and will get hot. With the metal tab against the table and the leads pointing down, the terminals are numbered 123, 1 is input, 2 ground and 3 is output.
    JS
    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.

  32. #312
    Join Date
    Oct 2006
    Location
    Cape Town SA
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    I come across many LCD's with incandescent globes inside them not LED's for the backlight, and designing the resistor for a 2.4V led will result in a whack of over-current. Just increase the series resistor to the backlight pins untill the display is only as bright as it really needs to be (try 150 ohms), this will certainly get you out of trouble with the regulator, and as they already advised you, feed it from the 'raw' side of the regulator not from the 5V regulated side. The backlight is completely isolated from the 5V rail of the LCD.

  33. #313
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I actualy tried the 150 Ohm, and it gets hot just as fast.
    NO the regulator is installed correctlt, with the 12v pin (1) on the outside, far away of the IC.
    I cant play around too much with the circuit now, I will try it as is see, or get myself a 2amp regulator. Have to go to the store anyway to get an Lm331.
    thanks
    ken

  34. #314
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    HI
    I am back working on my remote control code. I previously had two input for A/D. I needed to add another for my voltage checker. I used port B7 for the an6. or pin 13 on my pic16F88. When I dont put in the pic chi I read a voltage, say 0.8 volt. But when I put in the chip I do not read any voltage.
    I tried the same circuit on a bread board and it do not do that. Could it be hardware or software. here is bit of the code:

    just read below
    Last edited by lerameur; - 4th February 2007 at 01:46.

  35. #315
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I finally found where the problem lies but dont know how to fix it. The led blinks but after 4-5 blinks, with the subroutine , it stops. If I dont put a subroutine it keeps on blinking. here is my program.
    thanks

    INCLUDE "modedefs.bas"
    @ DEVICE PIC16F88 , HS_OSC , WDT_OFF , PWRT_ON , BOD_ON , LVP_OFF , PROTECT_OFF
    DEFINE OSC 20 'use external 20mhz crystal
    CMCON = 7 : ANSEL = 0 : ADCON1 = 7

    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    ADCON1 = %00100010 ' Set PORTA analog and RIGHT justify result, ADCON1 = %10000010 for 10 bit
    ADCON0 = %10010010
    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %10000000
    input1 var byte
    loop:

    ADCIN 6, input1
    pause 30

    if input1 > 255 then
    portb.3 =0
    else
    goto blinker
    endif
    goto loop

    Blinker:
    portb.3 =1 ' Turn on LED connected to PORTB.6
    Pause 500 ' Delay for .5 seconds
    portb.3 =0 ' Turn off LED connected to PORTB.4
    Pause 500 ' Delay for .5 seconds
    return

    end
    Last edited by lerameur; - 4th February 2007 at 02:20.

  36. #316
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default What is the value of input 1?

    Quote Originally Posted by lerameur View Post
    I finally found where the problem lies but dont know how to fix it. The led blinks but after 4-5 blinks, with the subroutine , it stops. If I dont put a subroutine it keeps on blinking. here is my program.
    thanks

    INCLUDE "modedefs.bas"
    @ DEVICE PIC16F88 , HS_OSC , WDT_OFF , PWRT_ON , BOD_ON , LVP_OFF , PROTECT_OFF
    DEFINE OSC 20 'use external 20mhz crystal
    CMCON = 7 : ANSEL = 0 : ADCON1 = 7

    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    ADCON1 = %00100010 ' Set PORTA analog and RIGHT justify result, ADCON1 = %10000010 for 10 bit
    ADCON0 = %10010010
    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %10000000
    input1 var byte
    loop:

    ADCIN 6, input1
    pause 30

    if input1 > 255 then
    portb.3 =0
    else
    goto blinker
    endif
    goto loop

    Blinker:
    portb.3 =1 ' Turn on LED connected to PORTB.6
    Pause 500 ' Delay for .5 seconds
    portb.3 =0 ' Turn off LED connected to PORTB.4
    Pause 500 ' Delay for .5 seconds
    return

    end
    Hi leramuer,
    do you know the numerical value of input1 ?
    Maybe the code is doing exactly what you asked it to do.
    if input1 is greater than 255 shut off LED, if code is less then goto blinker,

    maybe add in a debug and check value of input 1 as far as pic understands value.

    edit: your comments in the blinker sub tripped me up, thought it was switching two different ports.
    edit2: input var byte
    if input > 255 then . . . 255 that's all a byte will hold . . . correct?
    should not you select a number that is smaller?
    Last edited by Archangel; - 4th February 2007 at 04:39.
    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.

  37. #317
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    The comments are irrelevant for the ports in this case.
    It blinks a few times then stps, thats why I dont understand. I will need to solder some wires and hook up a lcd to see what is happening.

    ken

  38. #318
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Here we observe a nice stack UNDERflow example...

    Change your GOTO Blinker to GOSUB Blinker

    OR change your RETURN FOR A GOTO Loop
    Last edited by mister_e; - 4th February 2007 at 18:57.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  39. #319
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    yes thats, I knew it was software , could not get my finger on it. Thanks, it works.

  40. #320
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Good!
    Something to remind: Always be careful when mixing Gosub, Goto and Return together

    Joe S. ... i'm a bit disapointed
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts