pic18f4620 read write internal ram

Status
Not open for further replies.

berryman

New Member
hi, ı need to wirte and read from internal ram in pic18f4620.
ı wrote the code below. but its not workng in the enclosed **broken link removed**
it s important for me so can u help please??

#include <18f4620.h>
#include "HDM64GS12.c"
#include "graphics.c"
#include <math.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock=4000000)

/********* ********/
int i,j;

int sat=16,sut=16;

int u[16][16]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
0, 1 , 1 , 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0,
0, 1, 1, 0 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1 , 0, 1, 1 , 1, 0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 0 , 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 0 , 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
0, 1, 1 , 0 , 1, 1, 1 , 1, 1, 1, 0, 1, 1, 1, 1, 0,
0, 1 , 1, 0 , 1, 1, 0, 1 , 1, 1, 1, 0, 1, 1, 1, 0,
0, 1, 1, 0 , 1, 0, 1, 1, 1 , 1, 1, 1, 0, 1 , 1, 0,
0 , 1, 1 , 1 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0,
0, 1, 1, 1 , 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1 , 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1 , 1, 0,
0, 0, 0, 0 , 0, 0 , 0, 0, 0 , 0, 0 , 0, 0, 0 , 0, 0 };

int16 *ptrx, *ptry;



void main ( )
{
setup_psp(PSP_DISABLED); // PSP birimi devre dışı
setup_spi(SPI_SS_DISABLED); // SPI birimi devre dışı
setup_timer_1(T1_DISABLED); // T1 zamanlayıcısı devre dışı
setup_timer_2(T2_DISABLED,0,1); // T2 zamanlayıcısı devre dışı
setup_adc_ports(NO_ANALOGS); // ANALOG giriş yok
setup_adc(ADC_OFF); // ADC birimi devre dışı
setup_CCP1(CCP_OFF); // CCP1 birimi devre dışı
setup_CCP2(CCP_OFF); // CCP2 birimi devre dışı

disable_interrupts(GLOBAL);

glcd_init(ON);
ptrx=(int16 *) 0x100; // address in ram
//ram write
for (i=-1;i<sat-1;i++){
for(j=-1;j<sut-1;j++){
*ptrx=u[j];
ptrx=ptrx+1;
}

}


//read
ptry=(int16 *) 0x100;
for (i=0;i<sat;i++){
for(j=-1;j<sut;j++){
if(*ptry==0) {
glcd_pixel(j,i,ON); }
ptry=ptry+1;
}
}

}
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…