bigdogguru
Administrator
- Joined
- Mar 12, 2010
- Messages
- 9,821
- Helped
- 2,350
- Reputation
- 4,694
- Reaction score
- 2,272
- Trophy points
- 1,413
- Location
- Southwest, USA
- Activity points
- 62,394
yes.. Im very eager to learn.. :xCan't you sleep?
with the exceptions being RA4 and RA5
RA5 is MCLR it is one direction only and cannot use as output.
so after disabling the comparator I can noW use the RA4 with external pull up..right? ..
Yes and No, its an open drain output, so it can sink current, but not source it.
need to specify the direction of the digital i/o on PORTA with TRISA register.
I found this tutorial page showing open collector outputs which are somewhat similar in behavior to open drain outputs like RA4:
PIC Tutorial Hardware - Open Collector Outputs
Some tutorials with 16F628 specific source code:
WinPicProg PIC Tutorials - PIC16F628
I came across the tutorials above, you probably have already checked them out, they are PIC16F628 specific.
Let me know if you need any more help with your ISRs.
Ciao
#include<htc.h>
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLREN & BORDIS & DATUNPROT & UNPROTECT);
char count;
void interrupt timer0_isr(void)
{
T0IF = 0;
PORTA++;
count++;
}
main()
{
// initialize timer 0;
OPTION = 0b0111; // prescale by 256
T0CS = 0; // select internal clock
T0IE = 1; // enable timer interrupt
GIE = 1; // enable global interrupts
CMCON = 0x07;
TRISB = 0b00000000; // output changes on LED
TRISA = 0b00000000;
while(1)
{
if(PORTA > 1)
PORTB++;
}
}
#include<htc.h>
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLREN & BORDIS & DATUNPROT & UNPROTECT);
char count;
void interrupt timer0_isr(void)
{
T0IF = 0;
PORTA++;
count++;
if(count > 16)
{
count = 0;
PORTB++;
}
}
main()
{
// initialize timer 0;
OPTION = 0b0111; // prescale by 256
T0CS = 0; // select internal clock
T0IE = 1; // enable timer interrupt
GIE = 1; // enable global interrupts
CMCON = 0x07;
TRISB = 0b00000000; // output changes on LED
TRISA = 0b00000000;
while(1);
}
Sounds unlikely.I cannot use all the conditional statement like while(), if(). etc... I dont know why this is happening
PORTA=Astate++;
int count = 0;
void interrupt timer0_isr(void)
{
T0IF = 0;
PORTA++;
count++;
if(count > 16)
{
count = 0;
PORTB++;
}
}
Unfortunately, I don't use the Hitech-C compiler.can you compile my code above and return to me the hex file?
#include<htc.h>
__CONFIG(INTIO & UNPROTECT & DATUNPROT & LVPDIS & BORDIS & MCLREN & PWRTEN & WDTDIS);
char count;
void interrupt timer0_isr(void)
{
T0IF = 0;
PORTA++;
count++;
if(count > 16)
{
count = 0;
PORTB++;
}
}
main()
{
// initialize timer 0;
OPTION = 0b0111; // prescale by 256
T0CS = 0; // select internal clock
T0IE = 1; // enable timer interrupt
GIE = 1; // enable global interrupts
CMCON = 0x07;
TRISB = 0b00000000; // output changes on LED
TRISA = 0b00000000;
while(1);
}
they are same....... only thing is configuring them and using them is different...
by the way.. in 8051 it is called UART and in PIC USART.. based on some site I read about they are both the same.. right?
haha finaly it worked!!!!! hahaah Im now happy!!
HI-TeCH C was the Culprit I downgraded it to v9.80
Have you done any hard drive maintenance lately, defragmentation, error scanning, etc. Scanned for viruses lately?
as of now, None.. ..any other programs giving you trouble?
Im using before the bundled HI-TECH C from mplab. and myv 9.80 was from htsoft.comAre you downloading the Hi-Tech C installation directly from Microchip or Hi-Tech?
I understand Microchip is releasing a Java based IDE, similar to or based on Eclipse, MPLAB X. I downloaded the beta, but haven't had the time to install it.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?