Hello Ladies & Gents,
I'm attempting to make a countdown timer using eight seven-segment digits controlled by a MAX7221. Upon initial breadboarding I got it to work. However, I decided to change some wiring to have the digit order better agree with the software and it hasn't worked since. At one point I accidently hooked up the current limiting resistor to the MAX7221 to the Vcc line. I've replaced the MAX7221 with a new one. I bought new breadboards and build a new circuit from scratch, also without luck. I'm blinking an LED to indicate when the program starts and stops and that works fine, so the program is running. I've also tried placing LEDs on the data, clock and enable lines to check the I/O pins and they work fine. I noticed in a previous topic that the there may be noise and added 10uF and 0.1uF capacitors - still no luck. I've included the code and a schematic of what I've build.
I do not have the DS1302, buttons or photoresistor connected yet as I'm stuck trying to get the MAX7221 to work. Outside of ESD problems or gremlins, I'm stuck. Any advice is greatly appreciated.Code:PORTA = $00 ' Set all port a pins low PORTC = $00 ' Set all port c pins low define OSC 4 ' Tell the program the oscillator is running at 4 MHz TRISA = %11111111 ' Make all port A pins inputs TRISC = %11100000 ' Make port C pins 4 & 5 inputs and the rest outputs PORTA = $00 ' Set all port a pins to low PORTC = $00 ' Set all port c pins to low CMCON.0 = 1 ' Turn off comparator module CMCON.1 = 1 ' Turn off comparator module CMCON.2 = 1 ' Turn off comparator module ADCON0.6 = 0 ' Use VDD as analog reference ANSEL = %00001000 ' Use AN3 as analog input and set all other analog ' inputs to digital pins CS_Max VAR PORTC.3 ' Chip select for MAX7221 IC CS_DS VAR PORTC.2 ' Chip select for DS1302 IC SPI_CLK VAR PORTC.0 ' Clock for SPI communication SPI_SDO VAR PORTC.1 ' Serial Data Out for SPI communication Tog_Switch VAR PORTA.1 ' Toggle switch Sel_Switch VAR PORTA.2 ' Select switch b1 VAR byte ' Button variable for toggle switch b2 VAR byte ' Button variable for select switch '*********************************************************************************************** HIGH CS_Max pause 500 ' Wait for 500ms Main: HIGH PORTC.4 PAUSE 500 LOW PORTC.4 PAUSE 500 LOW CS_Max ' Enable the MAX7221 to receive data SHIFTOUT SPI_SDO, SPI_CLK, 1, [$0F01\16] ' Turn on Display Test (light up all LEDs on all eight digits) HIGH CS_Max ' Pull chip select to MAX7221 high to act on transmitted data PAUSE 5000 ' Wait one second LOW CS_Max ' Enable the MAX7221 to receive data SHIFTOUT SPI_SDO, SPI_CLK, 1, [$0F00\16] ' Turn off Display Test HIGH CS_Max ' Pull chip select to MAX7221 high to act on transmitted data PAUSE 1000 ' Wait one second HIGH PORTC.4 PAUSE 500 ' Wait one second LOW PORTC.4 PAUSE 500 END ' End Program


I hope at some point in the future to try out your Instant Interrupts routine, as I read they're all the rage. Thanks again for your help!





Bookmarks