PDA

View Full Version : PIC508/9 Header



stay_aliveuk
- 2nd September 2006, 15:55
I am relatively new to the PIC 12c508/9 family, but have used the 16c84 with some success in the past.

Can anyone help me with setting up the ports etc (i think this is termed the header) in order that i can begin writing some software. I will be starting with blining a LED, but we all start somewhere.

Many thanks

Melanie
- 2nd September 2006, 18:36
May I suggest (really consider taking up this suggestion!) you invest in some F-series parts to play with. They can be erased and reprogrammed 100,000 times or more.

With a C-series part, it's a one-time only event. You make a mistake and it's land-fill. Unless of course you actually WANT a heap of PICs that will only ever blink a LED between now and doomsday and can't do anything else...

Once you've got a working design - and you never, EVER want to make a change to the program, C-series parts are there because they're cheap. But you NEVER use them if you're learning or playing... (unless of course you happen to own the factory and you don't mind bucketloads of waste)...

stay_aliveuk
- 2nd September 2006, 23:04
Thanks for your reply, However, my 16c84 IC's can be programmed and erased many times so I presume you are meaning the 12cxxx range of IC's which are 'one timers'.

I do have a jewel windowed 12c509 so I am able to re-programme it but, admittedly, after it has been under the sun lamp.

So, can I presume you suggest developing the software on a EE flash type pic then once I am happy with it look at putting on to a 12cxxx pic?

If so, then can you help with the first few lines of the code which are concerned with setting up the 12cxxx range of IC's, ie setting up the ports.

Thanks again

stay_aliveuk
- 2nd September 2006, 23:30
Since writing the previous message I have looked into the 'F' range of IC's and you are spot on, these are what I should be playing with, top advice.

Still could do with a pointer on what the first couple of lines should look like for say the 12F629, which is 8 pin device.

For example I always start with (for the 16c84)

' Set Up PortB

DIRS=%11111110 'set portb pins as input or output as necessary
PINS=%00000000 'set all portb pins low (or as necessary for each application)

' End of PortB Set up

'Main Program

Best regards

stay_aliveuk
- 2nd September 2006, 23:37
I really should wait a while before posting a reply. Since writing the above I have come across the following which may be what I am looking for:-

'************************************************* ***************
'* 12F629.BAS *
'* *
'* By : Leonard Zerman, Jeff Schmoyer *
'* Notice : Copyright (c) 2002 microEngineering Labs, Inc. *
'* All Rights Reserved *
'* Date : 06/04/02 *
'* Version : 2.42 *
'* Notes : *
'************************************************* ***************

BANK0 $0020, $005F
EEPROM $2100, $217F
LIBRARY "PBPPIC14"

include "PIC14EXT.BAS"

PORTL VAR GPIO
PORTH VAR GPIO
TRISL VAR TRISIO
TRISH VAR TRISIO

include "PBPPIC14.RAM"

'*-----------------------* EOF 12F629.BAS *---------------------*

It appears to be a generic header for the 12f629 afterwhich the main program is written. If so can you 'decifer' it for me, ie are the ports set up as ins or outs and are they set high or low to begin?

Thanks

Melanie
- 2nd September 2006, 23:45
Have a look at this thread...

http://www.picbasic.co.uk/forum/showthread.php?t=64

then this one...

http://www.picbasic.co.uk/forum/showthread.php?t=543