![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
First off, I think i'm getting to the end of the Inchworm woods!! haha Its working GREAT at the moment!
I have learned enough assembly to modify a program I found on the net to blink LEDs. I have made several patterns with 8 leds, but the program ends up being quite long. I need to see if there are simpler ways of doing things. Question 1. How do you tell how big your program is? I assume I will get an error if I try to fit more then the PIC can hold? 2. After I program a PIC with the inchworm, will the PGD and PGC pins (RB6 and 7 on a 16F628) become avalible for general use when the PIC is in the project it will be controlling? 3. I want to select from 4-6 led patterns with a rotary switch. Is this possible/advisable with a single PIC? I assume I could use 4-6 seperate PICs, one for each pattern, but I am guessing thats not needed. Does anyone have a schematic or link to a similar project so I can get an idea on how this is done? |
|
|
|
|
|
|
(permalink) | |||
|
Quote:
The easy way in MPLAB is to VIEW>Memory Usage Gauge. Quote:
No if you are using the debugger. Quote:
Use a LED matrix. You can build or buy one. Source a column, sink the rows you want to turn on sort of thing. Store patterns in memory. You could use a push button if you do not mind cycling through the patterns. A rotary switch would work but takes more port pins. I am sure you can find a tutorial on the web. Start with Nigels site. |
||||
|
|
|
|
|
(permalink) |
|
1. Assuming during desgin time and using MPLAB, go to View->Program Memory and look at the left column "Line". Line is the decimal number for the number of bytes the program is using. The code ends when you see a series of 3fff or ADDLW 0xff Once you get into things, you will need to use the Program Memory window frequently. You can also look for "...Programming Program Memory (0x0 - 0x437)" in the MPLAB ICD 2 Output tab. In this case my program ended at 437 hex or 1079 dec.
3. Do not use extra PICs for extra patterns. Rotarys are okay.... yet are so limited and consume to many lines of which you cannot spare for your small pin chip and large count of leds. Try rotary pulse generator. Optical or not, just something that sends a pulse. This way only one 1 i/o line is used. 2. I do not use inchworm so what I do for testing projects I use breadboards and have 5 colums dedicated for programming. When not programming I just pull off the 5-pin headers if the programming lines will interfer with normal usage, else leave the programmer connected and it powers the board as well. For dedicated PC boards I use a double-pole-double-through push button switch. It physically removes the programming pins from the PIC and connects the loads the the PIC with a single tap. See pic-dongle sample below. The programming cable plugs in to the left side. Same is done on my test breadboards http://www.anothercoilgunsite.com/8l...atic-8led3.gif Last edited by donniedj; 15th March 2007 at 01:35 AM. |
|
|
|
|
|
|
(permalink) |
|
I have done an application using the 8-pin dip 12C509 chip, driving 5 sets of series wired LED's for a small x-mas tree application. (The one Pin is Input only). With 5 pins, Bin 11111 = Dec 31 (i.e. 32 different patterns available)
I used Nigel's tutorial for storing the patterns, and then made them cycle trough 10 times at different delay speeds between each output series. The result is a x-mas tree that seems to have random lights flashing, and it keeps my 2 year old boy quite happy |
|
|
|
|
|
|
(permalink) |
|
Hi Andy1845c it’s possible with a single PIC.
But for the rotary switch you mentioned its wasting another more PIC pins. If you are using PIC16f628A the maximum LEDs will be 8.bcuz other remaining pins used to the rotary switch (8+8). It’s easy if you use a single switch to change your patterns. Using the external interrupt pin is very usefull in this case to place your switch. Last edited by Gayan Soyza; 15th March 2007 at 05:13 AM. |
|
|
|
|
|
|
(permalink) |
|
donniedj I like your PCB.Are you using the tonner tranfer method or silk screen method.
|
|
|
|
|
|
|
(permalink) |
|
Here's one of many PIC Tips & Tricks guides (can be hard to find on Microchips site). This includes running many LEDs from only a few I/O pins and more.
|
|
|
|
|
|
|
(permalink) |
|
Thanks everyone for the replys.
I only need output on 8 pins. This is what I am trying to build. http://www.youtube.com/watch?v=LvQFHBqHsew Only mine will have 8 lights insted of 6. A push button would be okay, but the rotary switch would be ideal. I want a master power switch and then a roatary to select the pattern. With a rotary, lets just say a 6 position, would I use 6 pins as input, and then when the PIC gets power to it, have the program check to see what pin has voltage and from that decide where in the program to start running? Would that be a crude description of what I need to learn to do? 3v0 - I found the Memory Usage Gauge in MPLAB, but it showed 0 on both sides |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
Thanks to u. I also want to Learn about Capture, Compare Modules in PIC, Infact i want to know that what they are and their application examples.... Any guide related to it??? |
||
|
|
|
|
|
(permalink) | |
|
Quote:
I'm currently using a 16F628A in a rocketry application with 5 input switches, 2 x 16 line parallel LCD, and 3 mosfet driver lines. Proton makes the coding sooo simple. I've tried to learn assembler, but I am way too thick to take it all in. With Proton, I was able to write fully working code (that is easily tweakable) for a commercial application within a day of opening and installing the product. Sorry if that sounds like an ad for a product, but for newbies to coding, it's definitely the way to get used to the architecture of PIC ucontrollers. Try it (free download of the lite version), you might even like it..
__________________
==== Shax. ==== A bus station is where a bus stops... A train station is where a train stops... On my desk I have a work station... Nuff Sed!!! |
||
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
The task should be trivial with a high-level language. Personally I use both C and assembly. Last edited by eng1; 16th March 2007 at 09:25 AM. |
|||
|
|
|
|
|
(permalink) | |
|
Quote:
Some useful methods you'll come across include the use of tables, indirect addressing, and the use of interrupts and an ISR (interrupt service routine) to automatically perform certain functions as simple background tasks. For example, you might implement 1.0-msec Timer 2 interrupts and an ISR that counts 1.0-msec "ticks" before performing certain simple tasks. You might break down your LED "patterns" into several tables, each containing "time" byte and "pattern" byte entries (or elements). Your ISR would simply update the LED port with the current "pattern" for "time" number of 1.0 msec interrupt cycles before moving on to the next table "pattern" and "time" entry. Your MAIN program would simply wait for a change in the rotary switch and set another variable that would tell the ISR which LED pattern table to use. Take care. Have fun. Regards, Mike Last edited by Mike, K8LH; 16th March 2007 at 05:13 PM. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
Last edited by blueroomelectronics; 17th March 2007 at 04:26 AM. |
||
|
|
|
|
|
(permalink) |
|
Thank u, Thank U..
blueroomelectronics Thanks again again and again.. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| A couple 'scope questions | zachtheterrible | General Electronics Chat | 7 | 3rd November 2005 12:51 PM |
| Couple of questions about lm111 op-amp | ThirtyTwo | General Electronics Chat | 7 | 29th August 2005 06:14 AM |
| Newcomers, please read! (PIC regarded) Upd. 0xD | Jay.slovak | Micro Controllers | 0 | 17th April 2005 01:04 PM |
| Couple of PIC Questions | joe_1 | Micro Controllers | 5 | 3rd May 2004 06:25 PM |
| Hi I'm absolute beginner and I have couple of questions | Super Mario | Micro Controllers | 4 | 25th October 2003 11:05 AM |