Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 8th September 2008, 06:24 PM   #31
Default

Quote:
However, you are not completely correct on your description of the 12 bit chips. On the 509 you can make calls to addresses in the 0x200-0x2ff region by setting the PA0 bit in status. You can also use the two pages that are not accessible to calls for tables as computed gotos will still work.
I thought I covered the bases with:

Quote:
These PICs have the instruction space divided into 512 word pages. Only the first 256 words of a page can be used as the destination of a subroutine call or instruction that modifies PCL. In addition, care must be taken that the page select bits in the STATUS register are set for a GOTO, CALL, or instruction that modifies the PCL.
Total memory space 1024 words, 512 word pages, so need to set page select bit (PA0) in STATUS register to access all of memory.

I'm not sure how you do a computed GOTO, but I do it by doing arithmetic on PCL to select the GOTO in a table of GOTOs, since that modifies PCL then the table of GOTOs must be in the first 256 words of each page. In that case I have used space in that area for GOTO's rather than data tables. I don't see the gain. Using GOTO's will allow one to move the body of a subroutine out of the top half of the page as long as the entry point is there.

My point was/is that one can do tricks to get around the limitations of baseline PICs, but that is something that is probably beyond the skills/understanding of a beginner.

Mike you are most geneous with the help you give beginners here on the forum.

Last edited by skyhawk; 8th September 2008 at 06:26 PM.
skyhawk is online now  
Old 9th September 2008, 02:44 AM   #32
Default

Sorry Skyhawk, I didn't see your earlier post and was responding to your post immediately above mine. You are also correct on the computed gotos, I didn't realise the call bug also effected writes to PCL.

Mike.
Pommie is online now  
Old 10th September 2008, 03:18 AM   #33
Default

Well Mr. Darkstar, I got myself a couple 12F509's and some HEF4894B 12-stage shift registers in my Digikey order today. We shall see how well this crappy little chip can drive a 3x3x3 LED cube.

The 12F509 took me some time to get used to. Took me an hour or two to figure out the chip's strange quirks and get an LED flashing on GPIO2. Now that I have the chip's oddities figured out I can move on. What a bare-bones chip!

My blinky prog:
Code:
	include	"P12F509.INC"
	__config _IntRC_OSC & _WDT_OFF & _MCLRE_ON

	cblock	0x07
	d1,d2
	endc

	org	0x000
init	movlw	b'11001000'	;clear T0CS for output on GPIO2
	option
	movlw	b'001000'	;set pins to all outs
	tris	GPIO
	clrf	GPIO		;zero all pins
main	bsf	GPIO,2
	call	delay
	bcf	GPIO,2
	call	delay
	goto	main

delay	movlw	0x3e		;0.2 second delay
	movwf	d1
	movlw	0x50
	movwf	d2
delay_0	decfsz	d1, f
	goto	del1
	decfsz	d2, f
del1	goto	delay_0
	retlw	0

	end
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 11th September 2008 at 04:55 AM.
futz is offline  
Old 11th September 2008, 06:19 AM   #34
Default

Quote:
Originally Posted by futz View Post
and some HEF4894B 12-stage shift registers in my Digikey order today. We shall see how well this crappy little chip can drive a 3x3x3 LED cube.
Aaarrrggghhh! My LED cube is common cathode, but my new shift registers are open drain, so I need a common anode cube! Oh well, I guess I'm building a new cube. Think I'll go 4x4x4 (for other MCUs) and red LEDs this time.

I can only use 3x3x3 of it with the 12F509 due to too few pins (509 has 5 outs). Need 2 pins to control the shift register and 3 for the anodes. Hmm... I guess I could add another shift register to control the anodes and would only need 4 output pins that way... And I could go to a 8x8x8 cube! (I'd probably run out of memory on this tiny chip though.)

__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 11th September 2008 at 06:29 AM.
futz is offline  
Old 11th September 2008, 06:28 AM   #35
Default

Why not just cascade two (or more) shift registers.

Mike.
Pommie is online now  
Old 11th September 2008, 06:32 AM   #36
Default

Quote:
Originally Posted by Pommie View Post
Why not just cascade two (or more) shift registers.
That had crossed my mind too. You're talking about controlling cathodes and anodes off a couple or three cascaded shift registers, right?
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 11th September 2008 at 06:33 AM.
futz is offline  
Old 11th September 2008, 06:55 AM   #37
Default

Yes, you could drive the anodes via high side PNPs. So 4*4 is 16 cathodes plus 4 anodes can fit on two 12 bit shift registers.

Mike.
Pommie is online now  
Old 11th September 2008, 07:10 AM   #38
Default

Quote:
Originally Posted by Pommie View Post
Yes, you could drive the anodes via high side PNPs. So 4*4 is 16 cathodes plus 4 anodes can fit on two 12 bit shift registers.
Groovy! It shall be done! Might have to solder together a control board. It gets very hectic wiring that much stuff on a breadboard. I'll just socket the PIC so I can replace it with a 12F683 later when I run out of space (and patience) with the 12F509. No interrupts! Ridiculous!
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 11th September 2008, 07:47 AM   #39
Default

I think you'll find the 2 level deep stack to be very constricting. And you'll miss things like addlw.

Mike.
Pommie is online now  
Old 11th September 2008, 09:12 AM   #40
Default

Quote:
Originally Posted by Pommie View Post
I think you'll find the 2 level deep stack to be very constricting. And you'll miss things like addlw.
Yes, it's ludicrous bodging lot's of extra hardware on because you're using too small a device, plus the 12 bit PIC's are very limited compared with the 14 bit ones, never mind the 16 bit ones.

In the distant past you had no choice if you wanted a tiny PIC, but for many years now you have been able to get 14 bit PIC's in 8 pin packages, even including A2D.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 13th September 2008, 07:13 AM   #41
Default

Quote:
Originally Posted by Pommie View Post
Yes, you could drive the anodes via high side PNPs. So 4*4 is 16 cathodes plus 4 anodes can fit on two 12 bit shift registers.
Here is where my electronics noobishness comes in. I understand (kinda) how to do a high side PNP switch, but what transistor can switch 320mA (16 LEDs @ 20mA)? Or should I be looking at MOSFET's or maybe Darlington arrays?
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 13th September 2008 at 07:14 AM.
futz is offline  
Old 13th September 2008, 09:13 AM   #42
Default

Quote:
Originally Posted by futz View Post
I understand (kinda) how to do a high side PNP switch, but what transistor can switch 320mA (16 LEDs @ 20mA)?
Almost all transistors can switch 320mA (only the very smallest can't) - it's not a very difficult power level.

Try a BC327 at 800mA.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 13th September 2008, 10:22 AM   #43
Default

Quote:
Originally Posted by futz View Post
Here is where my electronics noobishness comes in. I understand (kinda) how to do a high side PNP switch, but what transistor can switch 320mA (16 LEDs @ 20mA)? Or should I be looking at MOSFET's or maybe Darlington arrays?
2N4403 (PNP, Fairchild, 600 ma), TO-92 or SOT23
PN2907A (PNP, Fairchild, 800 ma), TO-92 or SOT23

FDN304PZ (P-FET, Fairchild, 2.4a, Rds(on) = 0.052 ohms), SOT23

MIC2981 (eight 500 ma high side sourcing drivers), PDIP or SOIC

Last edited by Mike, K8LH; 13th September 2008 at 11:55 AM.
Mike, K8LH is online now  
Old 13th September 2008, 04:25 PM   #44
Default

Thanks Nigel and Mike. All I have in stock is 2N3906. Guess I'll cook up another order and get some more parts.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 16th September 2008, 04:00 AM   #45
Default

Ha! Better yet, I had a look at one of the MM5451YN chips I recently bought just to see what they were about. Perfect! It's a 35-bit shift register with open-drain drivers for LEDs. Send a 1 as your first bit of 36 and it auto-latches when all 36 bits have been clocked in - so it only needs 2 pins, clock and data. Reasonable price too.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Reply

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



All times are GMT. The time now is 02:06 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker