hello, I am in need of some guidance please. I am using a 17c44 with 4Mhz crystal and writing extenally to M48z02-70(16 Kbit Zeropower SRAM for ST) . I am trying to read and write a 16 bit munber. In Mplab simulation it seems to run fine BUT in my circuit the chip seems to write only 8 bits and reads 16bits, from looking at the data on a logic analyser. I can write 0xaa to the lower 8 bits but do nto seem to be able to get 0x55 written into the upper 8 bits. I do read all 16 bits. Am I missing something simple or maing a silly mistake? Please help as I am going around in circles Thank you Sharon The bones of the code is below: //temp data memory locations static unsigned char high_mem1 @ 0x22; static unsigned char low_mem1 @ 0x23; //temp storage for read data static unsigned char hr_mem1 @ 0x32; static unsigned char lr_mem1 @ 0x33; lr_mem1=0x00; //clearing memory locations hr_mem1=0x00; high_mem1=0xaa; low_mem1=0x55; void main () { //initialisation here for(;;) { CLRWDT(); for(i=0;i<32000;i++) // routine writing to SRAM from { CLRWDT(); GLINTD=1; Write1(); GLINTD=0; } for(i=0;i<32000;i++) { CLRWDT(); Read1(); } } } void Write1(void) { #asm CLRWDT ; clear the watch dog timer movlw 128 ; load the table pointer with 0x8000 in SRAM movwf _TBLPTRH ; clrf _TBLPTRL ; tlwt 1, _high_mem1 ; high byte @ table latch // does not seem to write this tablwt 0,1, _low_mem1 ; low byte @table latch // writes 0xaa here #endasm } void Read1(void) // transfer of 8 bytes of data from program(external) memory // to data memory starting at 0x30 { CLRWDT(); // clearing watchdog timer #asm movlw 128 ; load the table pointer with 0x8000 movwf _TBLPTRH ; clrf _TBLPTRL ; tablrd 0,1, _lr_mem1 ; get 16 bit value in table latch tlrd 0, _lr_mem1 ; low byte @table latch, latch @prob.mem // reads 0xaa successfully tablrd 1, 1,_hr_mem1 ; high byte @ table latch // reads a random value.. 1's #endasm } -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body