I posted a basic question recently re: request for sample programs for the 12CE67X processor. Getting no sample programs from the newsgroup, I asked Microchip for some help and got some excellent assistance to get me started from support person Brent Walters. > I would like to make a comment. With the 'tons' of information available > on the PIC, it is very frustrating to me to be unable to get what I think > should be simple information without having to do what I did - go and > bother Bret Walters with a question I should have been able to find out > for myself. > > I am a senior electronics teck (meaning I'm old, but not necessarily good) > and using a PIC seems to me to be much more efficient than using discrete > logic to do some of the day to day small interfacing projects I am > involved with. > > The main point is I am just an occasional PIC user, not a programmer/teck > who works with PIC every day. It's just another tool to me. A > potentially good and powerful one, but not the only one. I wear many > other hats and I have too many other duties to spend the time to become an > expert. This isn't meant as a 'whine' - its just a fact. > > I am starting to use the 16CE674 processor and am having a hard time > finding simple sample programs. Sample programs that I could take and > modify to start me on my simple project. This seems to be a very > difficult task - to find sample code for a specific processor. > > Perhaps I am not looking the correct way, but I have tried searches on the > net, on the Microchip web site and on the PIC list, looking back through > the last two years of messages, which I have archived as I find it an > excellent technical forum. > > For example, when I wanted to start using the 84, I went and purchased a > stepper motor controller and a LCD controller using that chip, and also > went through the EPE PIC tutorial in Everyday practical Electronics March > 1998. The only thing I had to do was convert the TASM files to MPLAB, > and I found a program to do this. > > I liked the 12C67X chip as it is only 8 pins, needs no xtal and has A/D > option. I wish it was EE programmable. (Is there one available?) > > At any rate please forgive my rambling. I think Microchip is missing a > lot of occasional users for their chips. I would much rather change a few > lines of code than have to update a schematic, re-make a PCB board, send > it out, build it etc. but (I think) Microchip has to make it easier for > beginners. Give us some simple programs that we can modify and play with > and in the process we will become proficient in using the chips (in a > painless way) and they would have a new convert and hopefully sell a lot > more chips to a market they haven't completely tapped before. > > Sounds like a win - win to me. > > Have a nice day > > Mike > > Mike Montaigne > Neutron Program for Materials Research > Steacie Institute for Molecular Sciences > National Research Council > c/o Atomic Energy of Canada Ltd. > Station 18, Chalk River > Ontario, K0J 1J0, Canada > Email: montaignem@aecl.ca > Phone: (613) 584-3311 Ex:4005 > Fax: (613) 584-4040 > > > > > ---------- > From: Tech.Support@Microchip.com[SMTP:Tech.Support@Microchip.com] > Sent: Friday June 29, 2001 11:04 PM > To: montaignem@aecl.ca > Subject: Setting up I/O ports on PIC12CE67x with Sample Code > > <> > > Try this. This sample code sets up the PIC to have one A/D input. The > A/D > input is not used as this is only port setup code. Another pin is a > digital input and the rest are outputs. > > ; To set up ports in a PICmicro device, it is important to check the pin > ; function table. It will tell you what pins are multiplexed with what, > ; and therefore you will know what functions may conflict with your > ; use of the I/O lines. For the PIC12CE67x, some lines are analog as > ; well, so we check the A/D section for information on setting up the > ; pins. > > ; The pins can be in analog or digital mode, and this is controlled by > ; ADCON1. Then, like any other PICmicro, the direction can be changed, > ; TRISIO controlls direction, a bit set to a 1 puts the respective pin > ; in input mode, a 0 puts it in output mode. Finally, GPIO controls > ; the output level if the pin is in output mode. If the bit of GPIO > ; is a 1, (and the pin is in digital and output mode) it will output a > ; high. Else with a 0 it will output a low. > > ; The sample code below provides an example. > > #include > > ORG 0 > BANKSEL ADCON1 ; BANKSEL is a directive - see the MPASM guide, that > ; automatically calculates the code needed to set > ; the bank bits to the appropriate value. Since > ; we have specified "ADCON1" which is in BANK 1, > ; MPASM generates code to set up to use registers in > ; BANK 1. The bank bits will remain set this way > untill > ; changed by more code such as the next BANKSEL. > ; this allows us to access ADCON1 (AND) TRISIO, as they > ; are both in BANK 1. > > movlw 0x06 ; This puts the hex value of 6 in W for use in the next > ; instruction > > movwf ADCON1 ; Set GP0 as analog, rest of I/O is digital > > movlw 0x03 ; Load 3 into W > > movwf TRISIO ; Set GP0 and GP1 as inputs (GP0 analog, GP1 digital) > > BANKSEL GPIO ; GPIO is in BANK 0, so BANKSEL calculates the code > needed. > > movlw 0x0F ; Load F (hex) into W > > movwf GPIO ; Set GP3-0 high (but only GP3 and GP2 will go high as > ; GP0 and GP1 are inputs) > > goto $ ; "$" means "this location" so this is a "goto this > location" > ; it forces the program counter to remain here and not > execute > ; more instructions > > END ; END must appear in every program to indicate the end > to MPASM > > > > I have also attached the code for you. > > There is one other important note. If you are wondering how I knew what > everything is called (such as TRISIO), it is all part of a definitions > file. Notice I used "p12ce674.inc". Open this file at look at it in > MPLAB. It contains a lot of definitions and they make coding MUCH easier > and more portable. The TRISIO and all other definitions are located > there. > Information on MPLAB and its directives such as END, BANKSEL and ORG and > many others are in the MPASM users guide. Click "Development Tools" then > "MPASM" to locate this information. > > Regards, > > Bret Walters > Microchip Engineering Support > > > > (See attached file: 12c674io.asm) > > > > > > > "Montaigne, > > Mike - NRC" To: > "'tech.support@microchip.com'" > > > ecl.ca> cc: > > Subject: Very basic question > > 06/29/2001 > > 08:27 AM > > > > > > > > > > > This question is so basic, I am embarrassed to ask it, but we all have to > start somewhere...... > > I have done a bit of programming with the 16F84 and want to do a small > project with the 12CE674. > > What I need is a (some) simple 12XX67X sample programs that I can start > with, and build on. I have searched you site but can't seem to find any. > Perhaps I didn't use the correct search algorithm. > > What would be extremely useful / is really needed for us beginners (am I > the > only one?) is 2 or 3 simple programs illustrating basic port setup. (For > the 12XX67X for example, one pin configured as an A-D input and another as > an input pin to select upper or lower and the rest of the pins to give the > upper or lower binary value of the A-D input.) The programs should be > simple, with not too many assembler 'tricks', so that the new user could > understand what is going on. > > My biggest problem is getting started with a new chip. There are millions > of (probably too many) PIC programs 'out there' but I can never find what > I > need. > > tks in advance - hope you can find me some simple programming for the > 12XX67X > > Mike > > Mike Montaigne > Neutron Program for Materials Research > Steacie Institute for Molecular Sciences > National Research Council > c/o Atomic Energy of Canada Ltd. > Station 18, Chalk River > Ontario, K0J 1J0, Canada > Email: montaignem@aecl.ca > Phone: (613) 584-3311 Ex:4005 > Fax: (613) 584-4040 > > > > > > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu