Honestly, I hadn't looked at it until now. Since he uses structs and a long divide, I'm not real surprised on the space requirements. Personally, I don't use C on a PIC since the hardware is not really up for it without allot of hoop jumping by the compiler. The 18F type PICs are more capable in this regard. So to each his own. I've used C on
8052's and I liked it, but it was a good compiler too (keil).
any
hardware
Everybody messes up software, 'cept me of course. ;-) I'm surprised that John seemed to take offense to my comment. I really wasn't trying to upset anyone, hence the smiley.
I would say that it's pretty selfless of Bruno to maintain a web site for the benefit of others.
"uiu" a écrit dans le message de news: snipped-for-privacy@4ax.com...
Non-blocking is the opposite of blocking : using blocking delay, the next code instructions will have to wait the end of the delay to be executed (the execution of the main program is suspended), whereas using non-blocking delay, the next code instructions will be executed after the start of the delay, and the delayed user code will be called after the delay completion. Meanwhile the execution of the main program continues.
a écrit dans le message de news: snipped-for-privacy@p10g2000cwp.googlegroups.com...
Cbarn, I have nothing to defend. Your assumption about shortening this code within 50 bytes may put beginners and newbies into confusion. This is not the best service they can get from here.
Is there something about a PIC that makes linked lists impractical?
The normal way to do this sort of thing is to only count away the shortest time delay. The delays need to be in some sorted form for this to work so a linked list is normally the way to go.
BTW: If you are doing this sort of thing in 8051 land, it is usually a good idea to put the routines address onto the stack and do a RETI so that the routine can be interrupted.
"Ken Smith" a écrit dans le message de news: duio2h$uo$ snipped-for-privacy@blue.rahul.net...
Yes you are right, linked lists are used in OS kernels to schedule tasks, and could be used on the PIC with mikroC.
The fact is, writing program examples leads to make choices between their clarity and effectiveness, and too much novelties in the same program may muddle the user with a heavier source code.
BTW, linked lists are very important and they deserve their own example in the very near future !
a écrit dans le message de news: snipped-for-privacy@e56g2000cwe.googlegroups.com...
They could believe that it is possible. I'm afraid this discussion could bore other people, so if you want to continue it, please give at least some technical argument or discuss it in private :
Electronics is not my field, so I scoured the internet to find counter circuits, but none of what I found really hits my exact needs.
I'm looking for a 2 or 3 digit counter that will count down from a predefined number to zero - with a RESET switch to send the count back to the max number.
to set the maximum number that the count starts at - a bank of 8 DIP switches gives me a max of 255.
I need to count objects passing a certain point and I figured I use a LED emitter and receiver pair, probably IR.
Do you want to build it or buy it? There's some simple to implement IC's that contain presettable up/down counters used with BCD encoded switches that contain most of what you need like the counters, digital comparators, and latched display drivers. Plenty of "robot" sites on the web with fairly easy to implement TV remote control style circuitry for break beam or reflective detectors.
If you don't need a display and never intend to change the count it may be less costly to build a discrete logic counter - but if it were me, I'd use one of the Intersil counters.
Likewise you can get a hold of an industrial controls catalog and buy a multifunction counter with display and optical sensor.
First option is inexpensive (in terms of money) time consuming, educational and personally rewarding.
Second option is fast, expensive and easy. Check a Graingers catalog for relatively cheap, ready made controls.
Build it for ~$50, buy it for ~$200
If you want to build it, look at
formatting link
The ICM7217 does it all in one IC and they show an LED example and LCD adaptation.
I had an application that required a presettable count down timer to switch a valve then start a second timer. (Intersil makes a modulus
60 counter as well as decade counters) Wiring and debugging took me two days with the intersil parts, and another day to package it for the lab to use. It was a breeze.
Doing the same thing with discrete logic elements would have taken me a week or two.
I could send you schematics of my timers - but the data sheet gives you what you need - my timer had a crystal controlled time base and some logic circuits to stop one counter and start the second one.
Likewise I have some schematics of break beam and retro reflective sensors.
--
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
--
If you only need to count and reset and don\'t want a numerical
display, you could use:
http://www.semiconductors.philips.com/acrobat_download/datasheets/74HC40103_3.pdf
with, perhaps, an LED to signal that the counter had reached zero?
You could use a simple CPLD - programmable logic - to implement your function to even include a 7-segment display driver if you need. The $49 development board from Xilinx
formatting link
should include everything you need to get a chip that does what you want. If you wanted to buy the kit but not get into the details of logic design, there are plenty of folks that could help, particularly at comp.arch.fpga (even if it is a cpld).
You could use dip switches, 0-9 rotary swiches, even a "set" mode like on your alarm clock though that method would lose its memory on power-cycle.
Your project takes me back to the early 70's, when I designed and built such a thing for my sister (and for my pleasure, of course). My circuit was a kitchen timer. As I recall, I used TTL Up/Down decade counter chips, wired for Down operation. Number of minutes was set by two thumbwheel switches. BCD of each switch was latched into the respective counters upon power ON; counters were decremented by 1 minute pulses from a counter driven by the AC line. When both decade counters reached "0", decrement was disabled and a Sonalert was switched on. Sis could hear that thing scream even when she was out in the back yard mowing the grass.
Well Andy I didnt say the whole program would be 50 bytes, just the parts that gives you the functionality, I hate that word, you simply cut and paste them into your existing program. 50 lines? oh no, 50 bytes, thats 25 lines max.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.