Electronics > Projects, Designs, and Technical Stuff
thoughts on my project
Prehistoricman:
Damn, that really sucks.
Maybe you can try using the whole-port names instead of bitfields. Like:
TRISA = 0x034; //RA0, 1 output. RA2, 4, 5 input
(PORTA & 0x10) > 0 //Reads RA4
(PORTA & 0x20) > 0 //Reads RA4
ali6x944:
--- Quote from: Prehistoricman on March 19, 2020, 12:04:58 pm ---Damn, that really sucks.
Maybe you can try using the whole-port names instead of bitfields. Like:
TRISA = 0x034; //RA0, 1 output. RA2, 4, 5 input
(PORTA & 0x10) > 0 //Reads RA4
(PORTA & 0x20) > 0 //Reads RA4
--- End quote ---
give me a minute...
Edit:
that doesn't seem to work :-//
Prehistoricman:
Just to clarify: does 'doesn't work' mean that it compiles fine but doesn't run fine?
Have you checked that the pins that you're outputting to are functioning normally? Did you do the LED check on these ones?
Can you set an output to turn the LED on, then change its pin mode to be input? Does the LED go out? Do this in a loop with output both high and low, just for sanity checking.
How are you compiling this? Perhaps this is a compilation issue.
ali6x944:
--- Quote from: Prehistoricman on March 19, 2020, 08:17:33 pm ---Just to clarify: does 'doesn't work' mean that it compiles fine but doesn't run fine?
--- End quote ---
exactly.
--- Quote from: Prehistoricman on March 19, 2020, 08:17:33 pm ---Have you checked that the pins that you're outputting to are functioning normally? Did you do the LED check on these ones?
--- End quote ---
yes, I did the LED check exclusively on the output pins (RA0, RA1), both timing and output voltage seem normal.
--- Quote from: Prehistoricman on March 19, 2020, 08:17:33 pm ---Can you set an output to turn the LED on, then change its pin mode to be input? Does the LED go out? Do this in a loop with output both high and low, just for sanity checking.
--- End quote ---
So what u want me to do is set (RA0, RA1) to be inputs? or am I missing something?
--- Quote from: Prehistoricman on March 19, 2020, 08:17:33 pm ---How are you compiling this? Perhaps this is a compilation issue.
--- End quote ---
didn't understand the question? do you mean the compiler type? it is XC8 v2.00
Prehistoricman:
--- Quote from: ali6x944 on March 20, 2020, 10:22:16 am ---So what u want me to do is set (RA0, RA1) to be inputs? or am I missing something?
--- End quote ---
Yeah. These are the steps:
Set pin to be output
Set pin high
delay
Set pin to be input
delay
Set pin to be output
Set pin low
delay
Set pin to be input
delay
loop (do it all again)
When you configure the pin as an input, it should go high-impedance. So any LED connected will turn off. What you should see is that the LED is only turned on for one delay (set this to be 0.5s or 1s).
This test is to confirm that setting the pin as an input is working correctly.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version