RECARDO Guest
|
Problem my code with 16f722 |
Posted: Sat May 02, 2009 4:31 pm |
|
|
Hi.
I do not use PORTA.3 PORTA.4 and PORTA.5 ports. fOR EXAMPLE
if (input(PIN_A2)){CLed=1;} else {CLed=0;} LED oK
if (input(PIN_A3)){DLed=1;} else {DLed=0;} LED İS NOT LIGHTING
if (input(PIN_A4)){ELed=1;} else {ELed=0;} LED İS NOT LIGHTING
if (input(PIN_A5)){FLed=1;} else {FLed=0;} LED İS NOT LIGHTING
pLEASE HELP ME
My code is here;
Code: |
#include <16F722.h>
//#device adc=8
#FUSES INTRC_IO, NOMCLR, PUT, NOWDT, PROTECT, NOBROWNOUT, NOPLLEN, NODEBUG, NOVCAP //No Watch Dog Timer
#use delay(clock=16000000)
//#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#byte PORTA = 0x05
#byte PORTB = 0x06
#bit Cinput = PORTA.2 //input
#bit Dinput = PORTA.3 //input
#bit Einput = PORTA.4 //input
#bit Finput = PORTA.5 //input
#bit CLed = PORTB.2 //out
#bit DLed = PORTB.3 //out
#bit ELed = PORTB.4 //out
#bit FLed = PORTB.5 //out
#int_RTCC
void RTCC_isr(void)
{
}
void main()
{ setup_oscillator(OSC_16MHZ);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(SPI_SS_DISABLED);
setup_vref(FALSE);
port_b_pullups(TRUE);
SET_TRIS_A(0b11111111);SET_TRIS_B(0b00000000);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_8); // 4Ms
setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
Delay_Ms(100);
While(True)
{
if (input(PIN_A2)){CLed=1;} else {CLed=0;}
if (input(PIN_A3)){DLed=1;} else {DLed=0;}
if (input(PIN_A4)){ELed=1;} else {ELed=0;}
if (input(PIN_A5)){FLed=1;} else {FLed=0;}
}
|
|
|