Re: Wiring SRAM to W65C265SQXB
Posted: Thu Jul 26, 2018 1:02 am
Hi folks, and thanks all who stopping by!
After a couple of days of "vacation" on a MSP430 I am back on this project now. I took some time off because I couldn't get the TIMER7 to work with interrupt enabled. Even a simple handler with only a RTI did not work, all I got was a locked up CPU.
While polling the flag worked fine, enabling the interrupt routine did not.
BTW The MSP430 has a very nice and versatile and clever instuction set ... well worth to be discovered and quite a relaxing experience.
Back to the 65C816, revising the code and studying the datasheet once again to see if I possibly had overseen something but to no avail: the code seems right to me but simply does not work.
To try something different, I commented two lines of code which didn't seem very critical to me. When entering this code, the timer is not running (TER[7]=0) and the TIER[7] bit isn't set either. The idea behind setting the timer counter to zero was to start at a defined point, since this register is uninitialized after a reset as of the datasheet.
I still don't know what's wrong with this code, if anybody has a clue on that, please let me know.
Well, after this change, everything started to work like expected. I am using the TIMER7 interrupt to drive a simple counter on the PORTA and PORTB register of the 65C21 flashing some LEDs.
Another thing that I changed was replacing the ATtiny85 I2C BusMaster with a ATmega328 chip. I modified the firmware to support SPI for up to 8 slaves as well as adding support for reading the remaining four ADC ports of the chip.
Another benefit of this solution is that now both, 65C816 as well as ATmega328 communicate with the hardware UART instead of the SoftwareSerial of the ATtiny85.
Sending a simple command like "SPI02020011FF" from the 65C816 to the ATmega selects SPI slave #2, wich in my case is a SPI capable MCP41010 potentiometer IC and puts the wiper at position FF. Then the corresponding voltage can be read with the "ADC00", since the wiper of the MCP41010 is connected back to the A0 analog port pin of the ATmega328.
As you can see in the image below, I am running out of breadboards. Have to get some more since this project is far from beeing finished.
Happy breadboarding!
After a couple of days of "vacation" on a MSP430 I am back on this project now. I took some time off because I couldn't get the TIMER7 to work with interrupt enabled. Even a simple handler with only a RTI did not work, all I got was a locked up CPU.
While polling the flag worked fine, enabling the interrupt routine did not.
BTW The MSP430 has a very nice and versatile and clever instuction set ... well worth to be discovered and quite a relaxing experience.
Back to the 65C816, revising the code and studying the datasheet once again to see if I possibly had overseen something but to no avail: the code seems right to me but simply does not work.
To try something different, I commented two lines of code which didn't seem very critical to me. When entering this code, the timer is not running (TER[7]=0) and the TIER[7] bit isn't set either. The idea behind setting the timer counter to zero was to start at a defined point, since this register is uninitialized after a reset as of the datasheet.
Code: Select all
lda VAL16 ; set limit for Timer0
sta T7LL
lda VAL16+1
sta T7LH
; stz T7CL ; <== evil code
; stz T7CH ; <== evil code
lda TIER ; enable timer7 interrupt
ora #$80
sta TIER
lda TER ; enable timer7
ora #$80
sta TER
Well, after this change, everything started to work like expected. I am using the TIMER7 interrupt to drive a simple counter on the PORTA and PORTB register of the 65C21 flashing some LEDs.
Another thing that I changed was replacing the ATtiny85 I2C BusMaster with a ATmega328 chip. I modified the firmware to support SPI for up to 8 slaves as well as adding support for reading the remaining four ADC ports of the chip.
Another benefit of this solution is that now both, 65C816 as well as ATmega328 communicate with the hardware UART instead of the SoftwareSerial of the ATtiny85.
Sending a simple command like "SPI02020011FF" from the 65C816 to the ATmega selects SPI slave #2, wich in my case is a SPI capable MCP41010 potentiometer IC and puts the wiper at position FF. Then the corresponding voltage can be read with the "ADC00", since the wiper of the MCP41010 is connected back to the A0 analog port pin of the ATmega328.
As you can see in the image below, I am running out of breadboards. Have to get some more since this project is far from beeing finished.
Happy breadboarding!