[SOLVED] ports problem in pic24ep512gu814 ic

Status
Not open for further replies.

anboli

Full Member level 2
Joined
Mar 9, 2012
Messages
144
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,298
Visit site
Activity points
2,513
hi,

i designed the new schematic for the pic24ep512gu814 ic(16bit controller) with input output configuration. i just trying to identify whether all the IO pins are working or not by giving LED to all the IO pins. But what is the problems is, i write the code in MPLAB with CCS compiler, while i simulating with PICKIT3 with SFR registers it accessing only 8 bit not a 16bit. whether the problem is in compiler or with my configurations? could you suggest what will be the problem? follwing program was to blink all the leds in all the IO pin. it glowing in only LSB of 8bits only.,


#include <24ep512gu814.h>
#include "REGISTERS.H"
#include "PORT_BIT.H"
#use delay(clock=25M)

void main()
{
ANSELA = 0X0000;
ANSELB = 0X0000;
ANSELC = 0X0000;
ANSELD = 0X0000;
ANSELE = 0X0000;
ANSELF = 0X0000;
ANSELG = 0X0000;
ANSELH = 0X0000;
ANSELJ = 0X0000;
ANSELK = 0X0000;

TRISA = 0X0000;
TRISB = 0x0000;
TRISC = 0X0000;
TRISD = 0X0000;
TRISE = 0X0000;
TRISF = 0X0000;
TRISG = 0X0000;
TRISH = 0X0000;
TRISJ = 0X0000;
TRISK = 0X0000;

PORTA = 0x0000;
PORTB = 0x0000;
PORTC = 0x0000;
PORTD = 0x0000;
PORTE = 0x0000;
PORTF = 0x0000;
PORTG = 0x0000;
PORTH = 0x0000;
PORTJ = 0x0000;
PORTK = 0x0000;


while(1)
{

PORTA = ~PORTA;
PORTB = ~PORTB;
PORTC = ~PORTC;
PORTD = ~PORTD;
PORTE = ~PORTE;
PORTF = ~PORTF;
PORTG = ~PORTG;
PORTH = ~PORTH;
PORTJ = ~PORTJ;
PORTK = ~PORTK;
delay_ms(1000);
}
}
 

got the solution for this problem, i had declared the registers as #byte TRISA instead of #word TRISA.. that is the problem. byte is only for 8bit. and word is for 16bit.
thank you,
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…