On 6/19/2012 11:58 PM, Dave McGuire wrote: > On 06/19/2012 11:10 PM, Dan Roganti wrote: >> I'm trying to learn how to implement interrupts in C code for a Z80 >> controller board I made with a CTC and SIO/0 to get the console port >> running. I'm not having much success to figure out how to code this. I >> was wondering if there were any C code examples for the Z80 that I could >> use as a reference as the sdcc manual doesn't seem to describe this. > ... >> What I'm not sure is how to organize and code the proper syntax needed >> for the interrupt service routines on the SIO/0 interrupts. I'm familiar >> now with how SDCC lets me organize the I/O ports in C code. Using the >> "__sfr __at " syntax to define the I/O ports. > Hey, you're fifty feet from me. ;)
yea but your're above and I'm in the basement - it's not linear :) > > Here's an example ISR function prototype from some of my 8051 code: > > void timer0_isr(void) interrupt 1; yes, I remember this from the days working on the 68HC11. THe microntroller with the built-in peripherals were easier to tackle when it comes to interrupts. > > I guess the first question is what interrupt mode are you putting the > processor into? I assume mode 2...don't know offhand if SDCC's Z80 > startup code sets an interrupt mode for you or not. I know the Z80's > default after reset is mode 0. The CTC, SIO use IM2 > > In any event, I'd write a piece of code with an ISR defined in it as > above and look at the assembly listing. ok, I'll take a look > This part of the Z80 support > seems to be incompletely documented. > > (I didn't know you had gotten that far on your board yet...I'm swamped > until the ~24th with a work deadline but can hack on it with you after that) ok, I like to write some test code where I can use the interrupt from the timers to tweak the refresh rates on the DAC's for the display. And use the debug console to manually adjust the settings in real-time without having to re-compile. =Dan ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user