![]() | ![]() | ![]() |
| | #91 |
|
I want to avoid using .h files since...thats what i know( dont know whether its wrong or right)...when you call a function from a header file then it is replaced on every line the function is invoked..i-e a macro.I am already low on memory(i will have to use two pic micros if i use that technique).I want to differentiate between two ADC conversions(one for temperature and one for a SG) for which i wanted to use a bit.Secondly about the variable problem with two source files.. since i will store temp values in the internal EEPROM i want to use a variable as a counter till 100 and use that same variable as an address to store data.What i have done is that i have given up checking that variable in main and used it in the ADC routine only. Thanks.
__________________ Syed Last edited by Wond3rboy; 16th August 2009 at 02:42 PM. | |
| |
| | #92 |
|
make a function like: int SetBit(int var, int bit){ var = var | (1<<bit); return var; } int ClearBit(int var, int bit){ var = var & ~((1<<bit)); return var; }
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #93 | |
| Quote:
I have gone through you cheat sheet(very helpful!). I can just use a 8bit data type cause i can use it for indication.Its the memory i want to save on but already worked around it. A question about setting automatic acquisition time.How can we do 1TAD? manually? Thanks.
__________________ Syed Last edited by Wond3rboy; 16th August 2009 at 03:58 PM. | ||
| |
| | #94 |
|
Which PIC...?
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #95 | |
|
The method I provided for a variable shared between files will use no additional memory. The variable is allocated in the file shareStuff.c only. 3v0 Quote:
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | ||
| |
| | #96 |
| 18LF4620. I am just trying it.
__________________ Syed | |
| |
| | #97 | ||
|
I have a few questions about timers, here's a paste from one of microchips manuals Quote:
What do I do with the read command? Does it place the value in a variable? How do I access the timer value once it has been read? Is the variable inserted in to that command, or is it a predefined one or what? I've been away from this for a while with work, so I'm trying to get caught up. Im working on timed multitasking now, but I have to figure out timers and timed interrupts first. I do understand how timed multitasking works in theory, but I'm learning how to actually code it in C18 now. Edit: found part of the answer to one of my questions in another microchip document Quote:
__________________ -Paul Last edited by Triode; 1st September 2009 at 07:08 PM. | |||
| |
| | #98 |
|
Straight from the manual: Code: 1.3.1 ReadTimer0 For TMR_V1, TMR_V2, TMR_V3, TMR_V4, TMR_V5 and TMR_V6 Function: Reads the value of the timer0. Include: timers.h Prototype: unsigned int ReadTimer0( void ); Remarks: This function reads the value of the timer0 register. Timer0: TMR0L,TMR0H Note: When using a timer in 8-bit mode that may be configured in 16-bit mode (e.g., timer0), the upper byte is not ensured to be zero. The user may wish to cast the result to a char for correct results. For example: // Example of reading a 16-bit result // from a 16-bit timer operating in // 8-bit mode: unsigned int result; result = (unsigned char) ReadTimer0(); Return Value: The current value of the timer. File Name: t0read.c
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 1st September 2009 at 07:52 PM. | |
| |
| | #99 |
|
Thanks, I got that far. Which structure do people generally use for multitasking? I can picture one where you have a loop that monitors the timer, and when it hits a value it increments all of the variables that are counting up for their respective tasks, and then resets the timer. Or one that has a timer interrupt triggered event that increments the variables then resets the timer. I'm guessing the ladder would be more accurate, but I'll have to learn to use interrupts to try it. I'm working on that right now.
__________________ -Paul | |
| |
| | #100 |
|
where did you learn multitasking? From the NET? (everything i learned or know about on any subject i learned online) Any good resources you can share?
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #101 |
|
I know so little about PIC timers. (or arm ) but i have a question since on the subject here. And not sure if you know but may benefit from a answer. If i have 2 times on a pic can i have both on at the same time? Also if so ... if both are on and 1 triggers. will the other continue counting? if so.... if the other triggers then which function will i be in?
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #102 |
|
I learned C++ programming mostly online, though I did take one class on it. And I've taken one other computer science class that went through all sorts of math and structure concepts, but that was focused on PC programming. So I am learning MCU programming from the internet. Trying to anyway, I'm just reading whatever microchip document seems related to what I'm doing and tutorials I find online, probably similar to what you're doing. I just get stuck a lot because there's so much out there, and cause I keep having long breaks in working on this where I'm too busy for my hobby. Anyway, once I develop a general structure for timed multitasking in C18 I'll be sure to post it, but its been slow going. right now I'm working off of this document http://w3.id.tue.nl/fileadmin/id/obj...NS_18F4550.pdf and in general, the manuals for C18 released by microchip, data sheets, errata and that whole mess.
__________________ -Paul | |
| |
| | #103 |
|
Have you read my tutorial on cooperative multitasking ? It uses a timer to block and enable tasks. Even if it is not what you want to do it should get you started. 3v0's Tutorials Bottom entry in the table 3v0-
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | |
| |
| | #104 |
|
I have, that's actually what I was using, I just lost track of it, like I said I was away from this hobby for a few months, so I forgot where some of the resources I was using were. Thanks. Its kind of hard to keep up a hobby when your life goes between super busy and a lot of free time, when you get a break you spend most of it just picking up where you left off. Oh well.
__________________ -Paul | |
| |
| | #105 |
|
It you document is fits I would be glad to add it to my list.
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | |
| |
|
| Tags |
| c18, questions |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| A few questions | erosennin | Feedback/Comments | 24 | 29th November 2007 12:08 AM |
| 2 questions | juan123 | Electronic Projects Design/Ideas/Reviews | 5 | 27th September 2007 03:46 AM |
| A few questions. | Marks256 | General Electronics Chat | 55 | 5th August 2006 11:49 PM |
| few questions | Victor Frankenstein | General Electronics Chat | 13 | 5th July 2005 07:29 PM |
| Questions? | Philipc | Electronic Projects Design/Ideas/Reviews | 4 | 7th August 2003 07:18 PM |