![]() | ![]() | ![]() |
| | #46 |
|
Hola Dark, Do you speak as you write? Nonstop until you said all you have to say in a row? I would not take the pain reading texts like that. Nor listening to a speech like that either. Look how professionals post here and compare.
__________________ Agustín Tomás In theory, there is no difference between theory and practice. In practice, however, there is. Last edited by atferrari; 16th September 2008 at 08:57 AM. | |
| |
| | #47 |
|
So I scraped through my transistor bin and found four 2N4403's. I'm not sure how to calculate base resistor values, so I just put 1.2KΩ ones on there. Seems to work ok so far. ![]() ![]() ![]() Now I need to write proper multiplexing/display handling software for it and build some kewl patterns for it to display.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 22nd September 2008 at 07:19 AM. | |
| |
| | #48 |
|
Looks good, are you still using the 509? Mike. | |
| |
| | #49 |
| Yes, but only as a bit of a challenge. When I get sick of the 12F509, out it goes and I'll control it with something that has interrupts and a bit more memory, and that I can program in C.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | |
| |
| | #50 |
|
Hahaha well I did get my hands on a 16f690 a few days ago but im still working with the 509 untill I can figure all this out properly haha but thanks for all the help anyways I have the parts coming in this week hopefully anyways thanks once again guys
| |
| |
| | #51 |
|
Some progress. I spent a while being confused with the MM5451 chip. I was sure that other shift registers I had worked with shifted to the left (towards the MSB). The 5451's datasheet isn't crystal clear about it, and my test code accidently worked, tho I was shifting the opposite way from what I expected. So when I wrote real code for it I got really strange behaviour. Finally I rewrote to shift to the right and everything works fine now. ![]() I haven't written the multiplexer yet (tonight maybe) but I do have it flashing LEDs properly.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 28th September 2008 at 10:46 AM. | |
| |
| | #52 | |
| Quote:
I'm just now tinkering with setting/clearing PA0 bits all thru the code to see if I can get it to all work. Sure makes what should be a simple thing into a royal pain in the butt!I think I hate the 12F509. What were they thinking? A timer with no interrupt! Paged program memory. Bleh. Soon I'll get disgusted enough to switch to the 12F683.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | ||
| |
| | #53 | ||
| Quote:
Quote:
Pins are cheap. To my mind using (a) shift register(s) with an 8-pin PIC makes no sense. It probably takes up more space and costs more than a 18, 28, or 40 pin PIC solution. If you need 28 or 40 pins, the 16F88x family is cheap and very capable. Last edited by skyhawk; 2nd October 2008 at 12:50 PM. | |||
| |
| | #54 |
|
Why not to move straight to the 18F family? Easier to program and more powerful.
__________________ Agustín Tomás In theory, there is no difference between theory and practice. In practice, however, there is. | |
| |
| | #55 | |
| Quote:
Anyway, to each his own! That's what makes the world interesting. | ||
| |
| | #56 |
|
futz do you mind posting the assembler for what you have maby I can adapt it for my needs ? also I still can't get ISCP working it might be the hookup im going to test it once again with a ohm meter to make sure its a good connection
Last edited by Darkstar64; 3rd October 2008 at 06:04 AM. | |
| |
| | #57 | |||
| Quote:
Here's a quote from higher up this page even:Quote:
When I get tired of messing with the 12F509, it'll go in the chip box and I'll connect the cube to something decent that'll make it easy to get it to do what I want. I have lots of PICs - very few of them are little 8-pinners.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | ||||
| |
| | #58 | ||
| Quote:
Quote:
Code: include "P12F509.INC" __config _IntRC_OSC & _WDT_OFF & _MCLRE_ON D equ 0 CP equ 1 cblock 0x07 d1,d2,d3,count,count2,patlen,patrep,temp,anode,offset,fsr1,frames,cathptr plex,cath1a,cath1b,cath2a,cath2b,cath3a,cath3b,cath4a,cath4b endc org 0x000 goto init patt1 addwf PCL,f retlw 0x04 ;pattern length - # of frames retlw 0x0a ;# of reps retlw 0xf0 retlw 0x00 retlw 0xf0 retlw 0x00 retlw 0xf0 retlw 0x00 retlw 0xf0 retlw 0x00 retlw 0x11 retlw 0x11 retlw 0x11 retlw 0x11 retlw 0x11 retlw 0x11 retlw 0x11 retlw 0x11 retlw 0x00 retlw 0x0f retlw 0x00 retlw 0x0f retlw 0x00 retlw 0x0f retlw 0x00 retlw 0x0f retlw 0x88 retlw 0x88 retlw 0x88 retlw 0x88 retlw 0x88 retlw 0x88 retlw 0x88 retlw 0x88 patt2 addwf PCL,f retlw 0x04 ;pattern length - # of frames retlw 0x0a ;# of reps retlw 0xf0 retlw 0x00 retlw 0xf0 retlw 0x00 retlw 0xf0 retlw 0x00 retlw 0xf0 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0xff retlw 0xff retlw 0x00 retlw 0x0f retlw 0x00 retlw 0x0f retlw 0x00 retlw 0x0f retlw 0x00 retlw 0x0f retlw 0xff retlw 0xff retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 retlw 0x00 init movlw b'11001000' ;clear T0CS for output on GPIO2 option movlw b'00001000' ;set pins to all outs tris GPIO clrf GPIO ;zero all pins movlw 0x08 ;set start level movwf anode movlw cathptr ;set cathode pointer movwf cathptr clrf plex bcf GPIO,D ;init MM5451 nop bsf GPIO,CP nop bcf GPIO,CP main call horiz call vert goto main horiz clrf offset ;point to start of table movf offset,w ;get pattern length call patt1 movwf patlen incf offset,f ;get # of reps movf offset,w call patt1 movwf patrep incf offset,f horiz1 call isr ;multiplex 256 times decfsz plex,f goto horiz1 anim movlw 0x08 ;set bytes per frame counter - 8 bytes movwf count movlw cath1a ;cathode pointer storage movwf FSR mloop movf offset,w ;get a byte of new pattern call patt1 movwf INDF incf offset,f ;increment pointers incf FSR,f decfsz count,f ;frame done? goto mloop decfsz patlen,f ;pattern done? goto horiz1 reset movlw 0x02 ;point to start of frames in table movwf offset decfsz patrep,f ;# of reps complete? goto horiz2 ;no, fix patlen and go again goto bail ;yes, done horiz2 movlw 0 ;get patlen again call patt1 movwf patlen goto horiz1 bail retlw 0 vert clrf offset ;point to start of table movf offset,w ;get pattern length call patt2 movwf patlen incf offset,f ;get # of reps movf offset,w call patt2 movwf patrep incf offset,f vert1 call isr ;multiplex 256 times decfsz plex,f goto vert1 vtanim movlw 0x08 ;set bytes per frame counter - 8 bytes movwf count movlw cath1a ;cathode pointer storage movwf FSR vtloop movf offset,w ;get a byte of new pattern call patt2 movwf INDF incf offset,f ;increment pointers incf FSR,f decfsz count,f ;frame done? goto vtloop decfsz patlen,f ;pattern done? goto vert1 vtrst movlw 0x02 ;point to start of frames in table movwf offset decfsz patrep,f ;# of reps complete? goto vert2 ;no, fix patlen and go again goto vtbail ;yes, done vert2 movlw 0 ;get patlen again call patt2 movwf patlen goto vert1 vtbail retlw 0 ;*************************** ;"interrupt" service routine isr rlf anode,f ;change to next level movlw 2 ;increment cathode pointer addwf cathptr,f movlw 0x10 ;is anode > 0x08? subwf anode,w btfss STATUS,Z goto shift ;no, go ahead movlw 1 ;yes, reset to anode 1 movwf anode movlw cath1b ;and reset cathode pointer movwf cathptr shift movf cathptr,w ;load FSR movwf FSR bsf GPIO,D ;shift out start bit nop bsf GPIO,CP nop bcf GPIO,CP movlw 0x02 ;set byte counter movwf count2 shift5 movlw 0x08 ;set loop counter movwf count movf INDF,w ;get a byte movwf temp shift1 rrf temp,f ;rotate ms-bit into carry btfsc STATUS,C ;is it 0? goto shift2 ;no, shift out a 1 goto shift3 ;yes, shift out a 0 shift2 bsf GPIO,D nop bsf GPIO,CP ;blip clock nop bcf GPIO,CP goto shift4 shift3 bcf GPIO,D nop bsf GPIO,CP ;blip clock nop bcf GPIO,CP shift4 decfsz count,f ;done 8-bits? goto shift1 ;no, go again decfsz count2,f goto shift6 goto shanode ;done cathodes - go do anode shift6 decf FSR,f goto shift5 shanode movlw 0x08 ;shift out anode byte movwf count movf anode,w movwf temp shan1 rrf temp,f btfsc STATUS,C goto shan2 goto shan3 shan2 bsf GPIO,D nop bsf GPIO,CP nop bcf GPIO,CP goto shan4 shan3 bcf GPIO,D nop bsf GPIO,CP nop bcf GPIO,CP shan4 decfsz count,f goto shan1 last3 movlw 0x0b ;shift out last 11 bits movwf count l3loop bcf GPIO,D nop bsf GPIO,CP nop bcf GPIO,CP decfsz count,f goto l3loop retlw 0 end
__________________ ========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 3rd October 2008 at 07:02 AM. | |||
| |
| | #59 |
|
I don't have the Pullup resister but yes its islolated using a DIP switch everytime I try to load code it tells me it can't read the OSSCAL or OSSCAL misread or something along those lines thanks for posted the assembler
| |
| |
| | #60 |
|
Srry Futz im a little confused on the engine part of it and how I would make it work for me with the 8 bit shift regiester's I need to output 2 8 bit strings can you explain it a little more thanks alot I almost have it this is the main engine right ? it takes the 8 bit's in the var temp and shifts them out one at a time clocking inbetween right ? this also loops 8 times so basically all I need to do is write 2 bit strings like this and it should work by the way im using GPIO 1 as the clock now is this correct or am I doing something wrong ? I can't seem to figure this out at all. All come up with a schmatic tonight and post it that im sure will help more then what im trying to just type Code: list p=12F509 ; list directive to define processor
#include <p12F509.inc> ; processor specific variable definitions
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
cblock 0x07
;***** VARIABLE DEFINITIONS
count,temp
D
CP
delay
endc
;**********************************************************************
RESET_VECTOR CODE 0x3FF ; processor reset vector
; Internal RC calibration value is placed at location 0x3FF by Microchip
; as a movlw k, where the k is a literal value.
MAIN CODE 0x000
movwf OSCCAL ; update register with factory cal value
movlw b'00001000' ;set pins to all outs
tris GPIO
start
movlw b'01010101'
movwf temp
movlw b'11100101'
movwf temp
goto start
;********Subroutines********
shift5 movlw 0x08 ;set loop counter
movwf count
movf INDF,w ;get a byte
movwf temp
shift1 rrf temp,f ;rotate ms-bit into carry
btfsc STATUS,C ;is it 0?
goto shift2 ;no, shift out a 1
goto shift3 ;yes, shift out a 0
shift2 bsf GPIO,1
nop
bsf GPIO,1 ;blip clock
nop
bcf GPIO,1
goto shift4
shift3 bcf GPIO,1
nop
bsf GPIO,1 ;blip clock
nop
bcf GPIO,1
shift4 decfsz count,f ;done 8-bits?
goto shift1 ;no, go again
END ; End of program !!
Last edited by Darkstar64; 3rd October 2008 at 09:02 PM. | |
| |
|
| Tags |
| pic, registers, shift, working |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| 16 bit serial in parallel out shift registers | forder | Electronic Projects Design/Ideas/Reviews | 14 | 2nd March 2009 09:17 AM |
| Cascading Shift Registers Help | Suraj143 | Electronic Projects Design/Ideas/Reviews | 13 | 5th June 2008 08:33 AM |
| Load shift-registers via SPI? | Mike, K8LH | Micro Controllers | 14 | 14th February 2008 03:00 AM |
| Help loading shift registers... | jrz126 | Micro Controllers | 0 | 14th November 2005 01:13 PM |
| shift registers | jrz126 | Electronic Projects Design/Ideas/Reviews | 8 | 25th September 2004 02:35 AM |