futz
Active Member
Definitely not the way it should be. Double check that all unused pins are set as outputs (or pulled high or low). Make sure your MCLR is pulled high.MatrixPhreak said:Is this normal? 'cause it doesn't seem like it...
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Definitely not the way it should be. Double check that all unused pins are set as outputs (or pulled high or low). Make sure your MCLR is pulled high.MatrixPhreak said:Is this normal? 'cause it doesn't seem like it...
#include<16f872.h>
#fuses HS,NOWDT,NOPROTECT,PUT
#use DELAY(clock=8000000)
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
void main(){
//Now I'm gunna clear all ports just to make sure that they're not interfering
set_tris_a(0x00);
set_tris_b(0x00);
set_tris_c(0x00);
/*Now gunna initialize the ports in the order I actually need them
/*As a note, I'm going to do this in binary to make sure ONLY the ports
/*I need are going to operational
*/
set_tris_a(0b00000001); //Set PIN_A0 input, all else output
set_tris_b(0x00); //Set ALL port B output
while (1)
{
if (input(PIN_A0))
{
output_low(PIN_B6);
}
else
{
output_high(PIN_B6);
}
}
}
Pommie said:You appear to have A0 floating, that is, not connected to anything. When you place anything near it, it will pick up stray voltages like the mains hum. This is what would be expected.
What did you expect would happen?
Mike.
not a problem with the code and instead a problem with my circuit?