On Fri, Sep 12, 2003 at 07:34:34AM -0500, Patrick Richards wrote: > Byron, thank you for your reply. You have given me several things to > think about. After seeing your code snippet, I have decided I should > really try to work out this whole problem myself instead of hacking up a > complete piece of code I found from Microchip. I have started to sketch > out the problem in pseudo code. Good. You'll generally be able to better utilize the tools you build instead of the ones you borrow. > [Languages snipped for brevity] > > > CBLOCK 0x2C ; CBLOCK will auto the address. > > ; 0x2C works for most 16F style pics. > > display ; Make sure to init to 0 > > ENDC > > > Update incf display,W ; Next display > > andlw 0x03 ; Keep in range > > movwf display ; And stick it back in display > > clrf PCLATH ; Paranoia. Keep in 1st page > > call disp2bit ; Convert to a bit number > > movwf PORTA ; and write to port A. > > return ; C-YA! > > > ; disp2bit presumes a couple of things. One is that W has the display > > number. > > ; Two is that PCLATH is cleared. Fix as necessary. > > > disp2bit > > andlw 0x03 ; Paranoia. Just in case W > 3 > > addwf PCL,F ; Jump table add > > retlw 0x0E ; Clear PORTA:0 > > retlw 0x0D ; Clear PORTA:1 > > retlw 0x0B ; Clear PORTA:2 > > retlw 0x07 ; Clear PORTA:3 > > Has someone on this PICList posted standards for coding and commenting? Not that I know of. Everyone has a different style. > I mean, how many tabs to indent for code and comments, what to > capitalize, etc. I usually use tabs in my code. Note I put spaces above because I have no clue what effect a tab will have on the 1500 different E-mail programs that are used to read this list. > > > You have another issue to think about. It's very likely that if you > are > > using a port pin to drive the cathode, that the display will be too > dim to > > be useful. > > You're definitely right about this. I prefer using a transistor for > each display. It helps me to keep all the work in the PIC instead of > depending on logic in another chip, but either method would work. Have > far along are you on segment multiplexing? I'm in the contemplation phase. ;-) > That would solve the power > problem for my situation, but I expect it would require quite a bit more > code. Not much more code at all. And definitely no additional hardware. I'd probably do it the same way as above using a segment counter and a 8 element jump table to convert the count to a bitmask. Then mask the bitmask against the current value for the display. I believe you said you had common cathode, so you can just write the masked value directly into PORTB. There are quite a few advantages (theoretically) to segment multiplexing: 1) You may not need high powered hardware since only one segment is on at a time. 2) Depending on how you wire whole displays you may get brightness variation based on the number of segments that are lit. Since segment multiplexing only turns on one segment at a time, you should get equal brightness. BAJ -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body