HC16z1 problem

Feb 12, 2007 0 Replies

Hello,



I have a freedom 16 mite v2 Hc16 controller working with a development board. I write to a memory addressed by CS2 and the chip select pin does not go low and as a result i am not getting an output on my data pins D[15,8].



The codes i wrote are



/*Function name: setpolc*/


void setpolc(int cell,int value) { poke(DACBASE, cell,value); //writing voltage to DAC delay(400); //allow the cell to settle to the new value }



/* Function name: ioboard_init Purpose: Initialize custom I/O board


*/

void ioboard_init(void) {



unsigned int reg=0; // Local variables


poke(REG_PG, PEPAR, 0); // All port E pins belong to E port (no bus ctl) poke(REG_PG, DDRE, 0); // All port E pins are inputs



reg=peekw(REG_PG, CSPAR0); // Get current value of CSPAR0 register reg=reg & 0xFC3F; // Clear bits 6-9 (function of CS2 and CS3 pins) reg=reg | 0x0280; // Set CS2 and CS3 as 8-bit chip selects pokew(REG_PG, CSPAR0, reg); // Write new value to register



pokew(REG_PG, CSBAR2, 0x0400); // CS2 will access 2 KB of memory at $4:0000 pokew(REG_PG, CSBAR3, 0x0500); // CS3 will access 2 KB of memory at $5:0000 pokew(REG_PG, CSOR2, 0x5070); // CS2 & CS3 memory characteristics pokew(REG_PG, CSOR3, 0x5070); // (see interface documentation)



}

I dont see the chip selects going low. And the blink all.c demo program has no effect on cs2 pin



Help in this matter will be very much appreciated



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required