PIC18f43k20 advise

Thread Starter

Man_in_UK

Joined May 13, 2008
192
After getting a PICkit 1 flash kit I have got my head round grabbing lines of code out the demo routines and putting them together to make my own simple programs.

I now need to up the pin count by a lot and I'm looking at the 18f43k20.

Question.
Is there a demo kit or similar that I can access to "borrow" code from ?
Without a working code to examine I would never get my head round the init routines to set up a monster like this.
 

nanovate

Joined May 7, 2007
666
Microchip has demo boards for their PIC18 stuff but you'll be using a different compiler also. They should also have some example code for you... just make sure it is for the SAME part number -- not all PIC18 were made alike.

This is one of the reason many folks switched to Atmel AVR -- same code will work with little to no mods on larger parts using the same compiler.
 

Thread Starter

Man_in_UK

Joined May 13, 2008
192
Thanks for the advise. It looks like I should not jump in too quickly.

I just noticed that the debug express kit comes with example code + project board. Although the kit comes with a QFP I would assume the code would be compatible with a DIP?

I will be using a DIP package for ease of assembly when I get the code sorted.
 

n9352527

Joined Oct 14, 2005
1,198
Have you got a real device to play with? The last time I checked the Microchip website, F43K20 was still tagged as a future device.
 

Thread Starter

Man_in_UK

Joined May 13, 2008
192
I was a bit quick to pick that model, no I dont have one. I just looked down the chip list to find the greatest numbers of I/O's and then worked backwards untill I got to a DIP.

I have since found the PIC2 debug kit comes all setup for the 16f887, that has the same number of I/O's and comes with demo code that will help me a lot.

I was looking for about 100 I/O's but to find that in a single DIP .......... yeah, I didn't think so.
 

SgtWookie

Joined Jul 17, 2007
22,230
100 I/O pins? :eek: That's a lot!

You know, you CAN effectively increase your I/O pin count by using CMOS shift registers, MUXes, etc. Using just three I/O pins, you could use one for a latch enable, one for a clock and the other to read the data being cranked in; data that was captured in the parallel-to-serial shift register(s) such as a CD4021B.
 

Thread Starter

Man_in_UK

Joined May 13, 2008
192
I know the theory about MUX stuff but I have never attempted to put it into use, yet. I was thinking of putting 2 or 3 16f887 together in a MUX setup .. I think I might have to to get the pin count up.

This project Im thinking about is bigger than anything I have looked into yet. A friend wants to automate his train set with about 6 senarios,
eg. senario 1
train sits at station for 10 seconds
leaves and takes a right at next points
takes left at next points
stops at next station for 10 seconds
etc etc until it arrives at the first station

Each senario is selected by a different controll button and each senario takes the train to a different station on different tracks. Sounds like a simple input / timer / output program and would be easy if it was a small train set.

Min requirements
15 sets of points (2 output, 1 each way) = 30
15 sets of signals ( 2 outputs) = 30
5 stations (1 sensor input)
15 points manual override switch
6 senario switch

This list does not include train run & speed controll and any other electrical stuff he is running. MY head hurts just thinking about it.
 

Thread Starter

Man_in_UK

Joined May 13, 2008
192
That expander looks like it would do. I just scanned down its data sheet to see what sort of data I would need to send it ...... errrr too complicated for me.

Unless its already been coded for a pic16 for me to copy and comes with idiot instructions I will struggle with that.
 

n9352527

Joined Oct 14, 2005
1,198
There are so many of them. Have a browse in RS or Farnell website (industrial automation section, logic controller).

Choose a unit that can be connected with I/O expansion modules, in this way you can have one controller unit handles all the necessary input and output. There are many different IO modules, such as relay, solid state, logic, analog, etc.

Programming can be done through the interface, or from PC with the supplied cable. A serial connection equipped unit would be ideal. The language is pretty simple, either ladder diagram or proprietary, but usually pretty intuitive.

Siemens Logo!, Telemecanique, Moeller, Omron, Crouzet, take your pick.
 
Last edited:
Top