Jump to content

Pierre

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Pierre

  • Rank
    Newbrie
  1. Thank you David, I know that using tris the way I do is not recomended but it works for all the other ports exept ra4 (in my program I do the test for other ports at the same time). But I will try to do your way to see if it works. I will come back to you later to give you the result. Thanks again. Pierre I am not sure what you intended your code to do but if you want to set the direction of a port or port pin you must write a value to the appropriate TRIS register e.g. I haven't shown it but you also need to manipulate the bank bits as the TRIS registers are in bank 1. Don't forget to change back again. Regards davidb
  2. Hi David, It seems that my reply was not sent so I'm trying again. Thank for helping me but I'm aware of the inversion. In my test program I toggle between on and off but the led stay on. I beleive the problem is somewhere else, maybe in configuration. Comparator are desable. Yes you are doing something wrong! Your logic is inverted. With the LED tied to Vdd if ra4 is set i.e. Logic 1 then your LED will be off. Clear ra4 i.e. Logic 0 and it will be on. Regards davidb
  3. Thankyou David for trying to find the problem, I appreciate. I'm aware that the output is inverted but in my test program I toggle between on and off with a pause between but the led stays on all the time. So it means that the open-drain is conductive all the time. I suspect the problem coming from a configuation but I don't know where. I have attached my test program. If you see any problem with it, please let me know. I have desable the comparator. Thanks Yes you are doing something wrong! Your logic is inverted. With the LED tied to Vdd if ra4 is set i.e. Logic 1 then your LED will be off. Clear ra4 i.e. Logic 0 and it will be on. Regards davidb test_open_drain.txt
  4. Hi, I know that ra4 is an open drain output and can only sink current but that is not the problem. I would like to know if ra4 can be used as an ordinary and direct output like the other output or is it used as the output of the comparator? Here is my problem. I have attached to ra4 a led in series wiht a resistance to vdd but the led stays on all the time. It should go on only when ra4 is set (bsf porta,4) and go off when ra4 is cleared (bcf porta,4). I'm I doing something wrong?
×