subject: [PIC] clock.asm Myke's McGraw-Hill pages are lost? This thread is about Myke Predko's "big" book, as I most simply call it. . . . >>Have you been able to get any of the code from link? . . . >>I tried the Clock project, and got the parts list, the pdf schematic and the asm file. . . . >Weird. I got the clock.pdf but not the asm file. Says the link is bad. What? Just now, past 03:30, local, it woked just fine. It's just a blasted text file with a funy extension, it shouldn't take any time or effort, should it? It came to me, DUN and all, no problem. I put it down at the bottom of this message, under the line of dashes. Now, I did find a true anomally that I have not encountered ever, in over ten years of WWW'ing: On the 'book' page, URL above, in the white text pane, near the bottom, there is a hyperlink for "readme.txt". The URL seems competent and consistent with others used nearby. My usual open-in-new-window routine got me a flashing window! An amusing trick for about two seconds. I hate Gates! I hate flashing! You are welcome to your own beliefs. So, in my usual constant desperate WWW hacking necessitated by Gates' constant incompetence, I just activated the hyperlink and let it destroy the 'book' window's contents. Flashing. The thing does claim to be a hyperlink to a text file, not a Javascript, too. This is weird, and I wonder whether it will repeat for me or for anyotherbody - I wonder. --- PS: still flashes! --- >I was told by Mcgrew-hill that they didn't include the CD because "they had problems making them". That's a beautiful excuse, innit? "I'm only fat/stupid/lazy _because_ . . . " Ah. That's right. I hate excuses. Hmmm. >The book was one of the worst I have ever seen and the company that published it is unable to even make CD's. I offer to copyread Myke's next book. This one was obviously not copyread. It only counts when it works! Myke is obviously very sharp with the PIC (and MCS51); I hate that I must sanity check every blasted character and punctuation mark in such a big book. I have found an incredibly large number of problems that anybody - everybody!!! - listed in the "acknowledgements" ought to have caught. A copyreader needs to know nothing but grade-school logic to catch contradictions! Now, "SPDT", used to label single-contact on-off switches throughout the entire book is electrical: "special knowledge" required!; fortunately I learned that special knowledge before age ten! (I wish for a 2005 version with PIC18Fxxxx information!) >They said all of the CD contents could be downloaded from their site. Looks like they have problems even doing that. Hmmm, this seems to be a trend. >Your mouse has moved. Windows needs to be restarted for the changes to take effect. [OK] Oh, yeah, this sort of a wisecrack might be funny to somebody that hasn't already needed to deal with such things today! Yes, I did laugh . . . Grinder --- PS: Why do I always need to hack just to _hope_ to win against Gates? (Yes, I do know that I never _can_ win against Gates.) So, I hacked. I created a HTML page with a hyperlink for "readme.txt"; upon "save target as" - finally, the error is reported without useless flashing. Pretty lame, Gates! --- --------------------------------------------------- title "Clock - 'Analog' Output from a clock" ; ; This Application uses a PIC16F84 controlling 5 74LS154 decoders, each driving ; up to 16 LEDs to tell the time. ; ; Hardware Notes: ; This application runs on a 16F84 executing at 32.768 KHz ; _MCLR is tied through a 10K Resistor to Vcc and PWRT is Enabled ; RA0 - RA3 Hour LED Output to Single '154 ; 0b00000 - 0b01011 - Hours 0 through 11 ; RA4 - Clock Set Button (Active Low) ; RB0 - RB7 Minute LED Output to Quad '154s ; 0b011100000 - 0b011101111 - Minutes 0 through 15 ; 0b011010000 - 0b011011111 - Minutes 16 through 31 ; 0b010110000 - 0b010111111 - Minutes 32 through 47 ; 0b001110000 - 0b001111011 - Minutes 48 through 59 ; ; Myke Predko ; 99.07.23 ; LIST R=DEC INCLUDE "p16f84.inc" ; Registers CBLOCK 0x020 Minutes, Seconds ; Current Minutes/Seconds, Hours in PORTA TimeInc ; Value to Increment the Minutes By Temp ENDC __CONFIG _CP_OFF & _WDT_OFF & _LP_OSC & _PWRTE_ON PAGE ; Mainline of Analog Clock Application org 0 Mainline ; Setup the I/O Ports and Drive them to 12:00 clrf Seconds ; Initialize the Current Time clrf Minutes movlw 1 ; Initially Increment by one minute movwf TimeInc clrf PORTA ; Hours to Zero movlw 0x0E0 ; Minutes to Zero movwf PORTB bsf STATUS, RP0 ; Goto Bank 1 to set Port Direction movlw 1 << 4 ; Just RA4 is Input movwf TRISA ^ 0x080 clrf TRISB ^ 0x080 ; PORTB is Output movlw 0x0D4 ; Normal Operation - One "Click" Every Second movwf OPTION_REG ^ 0x080 bcf STATUS, RP0 ; Go back to Bank 0 clrf TMR0 ; Start the Timer from Zero bcf INTCON, T0IF Loop btfss INTCON, T0IF ; Wait for Timer to Overflow goto Loop bcf INTCON, T0IF btfsc PORTA, 4 ; Timer Button Pressed? goto NoButton call TimeUpdate ; Yes, Increment the Time bsf STATUS, C ; TimeInc = ((TimeInc << 1) + 1) & 0x03F rlf TimeInc, f movlw 0x03F andwf TimeInc, f clrf Seconds ; Reset the Second Count goto Loop NoButton ; No Button Pressed, Just Increment Seconds movlw 1 ; Make Sure TimeInc is 1 (Button Not Pressed) movwf TimeInc incf Seconds, f ; Increment the second counter movlw 60 ; Has a minute gone by? subwf Seconds, w btfss STATUS, C ; Seconds > 59? goto Loop ; - No, Repeat for another second call TimeUpdate ; Update the Current Time clrf Seconds ; Reset the Second Count goto Loop ; Wait for the Next Second to Pass PAGE ; TimeUpdate Subroutine TimeUpdate ; Add Contents of "TimeInc" to Minutes and movf TimeInc, w ; Display the New Time addwf Minutes, f movlw 60 ; Have the Minutes rolled over? subwf Minutes, w btfss STATUS, C goto TUMinutes clrf Minutes ; New Hour, Reset Minutes incf PORTA, w ; How to Increment the hour? andlw 0x00F xorlw 0x00C btfsc STATUS, Z movlw 0x00C ; At 11 - Roll Over to Zero xorlw 0x00C movwf PORTA TUMinutes ; Convert Mintues to LED Positions movlw 0x00F ; Save the 16 Minute selection andwf Minutes, w movwf Temp call Get154 ; Get the Correct Value for the '154 iorwf Temp, w ; Have the '154 Selected, Add Minutes within 154 movwf PORTB ; and display return Get154 ; Return the PORTB value to Select the appropriate '154 movlw HIGH Get154Table ; Treat as a general table read movwf PCLATH swapf Minutes, w ; Get the Bank to Display andlw 3 ; Just interested in the LSB 2 Bits addlw LOW Get154Table ; Get the Table Value btfsc STATUS, C incf PCLATH, f movwf PCL Get154Table retlw 0x0E0 ; Minutes 0 - 15 retlw 0x0D0 ; Minutes 16 - 31 retlw 0x0B0 ; Minutes 32 - 47 retlw 0x070 ; Minutes 48 - 59 end __________________________________ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist