| View previous topic :: View next topic |
| Author |
Message |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
|
Posted: Mon Aug 21, 2017 6:31 am |
|
|
| Tris A A0 is input the rest is output! Yes INT RB is being called. I tested on my development board and it is working right apart the ADC. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20058
|
|
Posted: Mon Aug 21, 2017 6:36 am |
|
|
No.
You misunderstand The behaviour of some instructions.
Yes, the line:
set_tris_a(0b0000001); //switches A0 to be an input
Sets A0 to be an input, but the very next line:
output_a(0b0000000);
Sets the _whole_ of PortA to be outputs.
A byte wide output in standard_io mode, sets the TRIS as well as the output latch.... |
|
 |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
|
Posted: Mon Aug 21, 2017 6:37 am |
|
|
this is the pot resistance to PIC. I made the drawing on Proteus, and made no software simulation.
https://ibb.co/jaQ3z5
I just need that when the wiper is 5V it give 254 and GND it gives 0. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20058
|
|
Posted: Mon Aug 21, 2017 6:40 am |
|
|
I know what a B***p pot looks like.....
Read what you are being told, or just try it. You are incorrectly overriding the port directions, which is why the code won't work.... |
|
 |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
|
Posted: Mon Aug 21, 2017 6:44 am |
|
|
seems that that was the problem. Now it is working! I made the
to clear all the output to be 100% safe |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20058
|
|
Posted: Mon Aug 21, 2017 6:56 am |
|
|
Yes. It is perfectly fair to do so. but you then need to set the TRIS _afterwards_ to the value you require.
An 'output_x' sets everything in the port 'x' to output..... |
|
 |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
|
Posted: Mon Aug 21, 2017 6:57 am |
|
|
| thanks...I learned something new. Thanks for this clarification.. |
|
 |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
|
Posted: Mon Aug 21, 2017 7:02 am |
|
|
| I would like to take this opportunity to thank to those to help me to solve this problem. Perhaps for some of you it was a silly question, but for me it was very important to continue with my project. Once again thanks for your time and effort to help me, although you do not know me. |
|
 |
|