xpress_embedo
Advanced Member level 4
i am new to pic24fj128ga010 and using MPLAB C30 Compiler for its programming...
I write a simple code to toggle the PORTA and PORTB pins high and Low..
But that doesn't works with a timer
Pls help me..
Here is my code
Proteus Simulation
I am getting an error in proteus regarding clock frequency.. pls help me
I write a simple code to toggle the PORTA and PORTB pins high and Low..
But that doesn't works with a timer
Pls help me..
Here is my code
Code:
//Crystal Oscillator Connected is of 32MHz
#include<p24fj128ga010.h>
#define DELAY 15625
int main()
{
TRISA = 0; //PORT-A Output Port
TRISB = 0; //PORT-B POTPUT Port
PORTA = 0xFF;
AD1PCFG = 0xFFFF; //PORT-B as Digital Input Output Pin
PORTB = 0xFF;
//Timer Operation
//Timer-1 Control Register
T1CON = 0B1000000000110000; //T1CON = 0x8030
// TMR1 on, prescaler 1:256 Tclk/2
//Now we Will Toggles the LED's Connected at PORTB and PORTA
//with a Delay of about 250 msec
while(1)
{
TMR1 = 0;
PORTA = 0x00FF;
PORTB = 0x00FF;
while(TMR1 < DELAY)
{
//Wait Here
}
TMR1 = 0;
PORTA = 0x0000;
PORTB = 0x0000;
while(TMR1 < DELAY)
{
//Wait Here
}
}
return 0;
}
Proteus Simulation
I am getting an error in proteus regarding clock frequency.. pls help me