flip
Joined: 15 Feb 2005 Posts: 11
|
PORTt E, pin E0 when set to high cant output onto PORT D |
Posted: Wed Feb 23, 2005 12:32 pm |
|
|
For some reason when I set pin E0 to high and in a if statement (bit_test (input_e(), 0) == 1 ), then output on to Port D, Port D does not get displayed. However once I get out of the if statement the port D value outputs for a second. As well in the if statement all of the other ports output fine, even Port D. Except when I set E0 to high. I am guessing I am setting a fuse incorrectly but if you can figure it out that would be great. Thanks
Code: |
#include <18F458.h> //up/down counter with 1 7 segment displays no max or min
#use delay(clock=20000000) //check to see if casting works
#fuses HS, NOWDT,OSCSEN, BROWNOUT, BORV20, STVREN, NODEBUG, NOLVP
void main()
{
set_tris_e(0x00);
set_tris_c(0xFF); //hundreds display
set_tris_b(0xFF);
set_tris_d(0xFF); //tens display
while(1)
{
if(bit_test(input_e(), 1) == 1) //E1 = 1
{
output_b(0xFF); //All of the Ports output even D
output_d(0xFF);
output_c(0xFF);
delay_ms(1000);
output_d(0x00);
output_b(0x00);
output_c(0x00);
delay_ms(1000);
}
if(bit_test(input_e(), 0) == 1) // set E0 to 1 and it goes into the loop
{
output_b(0x0F);
output_d(0x0F); //Port D does not display,but Port C and B do display
output_c(0x0F);
delay_ms(1000);
output_d(0x00);
output_b(0x00);
output_c(0x00);
delay_ms(1000);
}
}
} |
|
|