This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C2123C.AF07D8E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi Bob I've included the latest code. The problem I can see is I am going to have to call the maxout subroutine at least three times. Which if I understand it wont work with the c54 because of the two level stack. Also I am not done with the hrs part. it was designed for 12 hr time. thanks again Mike Johnston ----- Original Message ----- From: "Bob Ammerman" To: Sent: Wednesday, June 05, 2002 6:32 AM Subject: Re: [PIC] Max7219 interfacing (was Shift Register Useage-TPIC6A595) > ----- Original Message ----- > From: "Michael Johnston" > To: > Sent: Wednesday, June 05, 2002 12:28 AM > Subject: Re: [PIC] Max7219 interfacing (was Shift Register Useage-TPIC6A595) > > > > This question is for Bob Ammerman > > Bob > > I have figure out how to get the max7219 into decode mode for eight > > digits. > > I have added this after I set cs low. > > movlw 0xff > > movwf portb,1 ; set max7219 decode mode 8 digits > > No, this isn't right. You have to send the 'decode mode' command to the chip > using the normal shift routine. > > > I have been trying to interpret the data sheet it says that the lower > > nibble of the 16 bits is all that it looks at. The way the ckt board is > laid > > out is that we have 8 sections laid out as digits with the individual > > segments laid out in sequential form. the max7219 is laid out to decode > the > > digits then the individual segments are part of each digit. do I have to > > have a data table for each digit 0-7 except the last which is 0-4. > > You should not need such a table if you are using the decode mode of the > 7219. However, if you haven't wired the segments up in the order that the > 7219 assumes, you will have to do the decoding in the PIC and not use decode > mode on the 7219. > > > I still > > haven't came up with a way to divide the time can you please point in the > > right direction. > > Sure. You are currently have 3 variables, one for seconds, one for minutes, > one for hours. You can change to using separate variables for the units and > tens digits of each of these values. You would use the same > increment-and-check-against-a-limit logic, the the limits would now be: > > 10 for the seconds units digit > 6 for the seconds tens digit > 10 for the minutes units digit > 6 for the minutes tens digit > > The hours get tricky depending on how you want to count them: 12 hour vs. 24 > hour, etc. > > > thank you > > I really appreciate the help you have giving me > > Keep working on it. > > Bob > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > ------=_NextPart_000_000D_01C2123C.AF07D8E0 Content-Type: application/octet-stream; name="archeon2.asm" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="archeon2.asm" ;------------------archeon2.0 mwj = 021902--------------------------------------=09 list p=3D16c54=09 radix dec ;------------------------------------------------------------------------= -------- cblock 0 =09 indf rtcc pc status fsr porta portb ;------------------------------------------------------------------------= --------- ; clock variables =09 sec mins hrs s1 s2 m1 m2 h1 h2 count srlo srhi ; sw1 ; sw2 ;------------------------------------------------------------------------= --------- endc ;------------------------------------------------------------------------= ------------- org 0 ;------------------------------------------------------------------------= ------- start movlw b'00001000' ;port a bit3 in rest out =09 tris porta movlw b'00110000' ;port b bit4 3 in rest out=09 tris portb ;------------------------------------------------------------------------= ----- wtforlo btfsc porta,3=09 goto wtforlo wtforhi btfss porta,3 goto wtforhi ;------------------------------------------------------------------------= ------- seconds incf s1,f ;increment s1 timer movlw 10 ;load w with 10 =09 xorwf s1,w ;compare s1 with w btfss status,2 ;has it reach 10 yet goto wtforlo=09 ; incf s2,f ;increment s2 timer movlw 6 ;load w with 6 xorwf s2,f ;compare s2 to w btfss status,2 ; =09 ; =09 movwf sec call maxout ;------------------------------------------------------------------------= ---- minutes incf m1,f ;increment the m1 timer movlw 10 ;load w with 10 =09 xorwf m1,w ;compare m1 with 10=20 btfss status,2 ;has it reach 10ms goto wtforlo ; incf m2,f ;increment the m2 timer=09 movlw 6 ;load w with 6 xorwf m2,w ;compare m2 with 6 =09 btfss status,2 ;has it reached 60 yet goto wtforlo ; movwf min call maxout ;-------------------------------------------------------------------- hours incf h1,f ;increment the hours timer movlw 1 xorwf h1,w btfsc status,2 goto wtforlo=09 ; incf h2,f movlw 13=09 movwf hrs goto=09 ;------------------------------------------------------------------------= ----- =09 maxout movf 0xff movlw portb,1 ;selecet decode mode 8 digits bcf portb,2 ;activate Load cs bsf portb,0 ;toggle clock nop bcf portb,0 movlw 17 rotate rlf srlo,f ;rotate 16-bit value , hi bit to carry rlf srhi,f ; btfsc status,0 ;copy carry to data pin bsf portb,1 btfss status,0 ; decfsz count,f goto loop bsf portb,2 ;------------------------------------------------------------------------= ----- = =20 goto start ; end =09 =09 =09 =09 =09 =09 =09 ------=_NextPart_000_000D_01C2123C.AF07D8E0-- -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics