As well as the three PWM channels? Er, not many really - I'd like a button or two to switch between different light shows, but that's all. The luxeons are something to think/worry about later I reckon - for now, just regular super-bright LEDs would be great!
I found the graph someone mentioned earlier : So it looks like I could get away with 10Mhz = 2.5Mhz instruction cycle? ...or run at 20MHz = 5Mhz instruction cycle, but for less time (batteries will reach a critical limit sooner).. ? Something's been bugging me about using resisitors. Surely if you use resistors to limit the current, at full charge everything's fine, but as the charge in the batteries drop, won't the LEDs dim? If you switched to a lower rated resistor, you could get them back to full brightness again though? That right or have I over-simplified / got it wrong?
I've been thinking again, and to make life much easier on myself, I'm thinking hardware PWM is probably the way forward (and yes, I know I keep changing my mind all over the shop ). The PIC16F73 seems to have 3 PWM channels, although I couldn't figure out from the datasheet how you set it up? ...and for that matter what the resolution is? It looked like 6-10 bits depending on how fast your PWM signal is. Does that mean I could achieve 6-10 different light levels? I need some more help here
http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf should tell you, i've not got time to read it i'm affriad (exam tommorow, and day after,and day after,and day after, all through to (and including) sat. barstards). but from memory i thought it was a 3 channel CCP, but only 2 channel pwm.
Damn, you're right. I wanted the 737 chip, which does have 3 PWM channels.. problem is, farnell doesn't stock them! Where else might I find PICs in the UK?
microchip! (buy!) rswww.com www.maplin.com www.rapidelectronics.com www.google.co.uk edit: but i still wouldn't give up on trying to code it. a 40mhz 18seires should give you 16 levels without too much hassal.
Okay, okay I get the picture.. Those were the sites I'd been looking at, just wondered if you knew of any more Looking at the datasheets, the normal (not LF) version will run at 40Mhz as long as it's supply is > 4.2v. The LF version does the same, but the speeds then ramp down as low as 2v. A friend of mine who's a little more electronic-savvy suggested using a DC-DC converter to make sure the voltage always stays high enough for the controller to run. What are your thoughts on this? From what I can gather from the datasheets, you need an external oscillator to get the high frequencies.. So, what sort of oscillator would you recommend? Thanks for all the help thus far - much appreciated. P.s - good luck with your exams! I have my last one on Friday
Oooh... update : My PIC-PG2C arrived in the post today! I have some 18F1320's in the post so maybe I can start trying some stuff soon
Finally got around to playing with a PIC tonight. I don't have time to test it tonight, but I hacked one of Hazer's tutorials up a little so that my PIC will strobe the lowest bit of port A on / off every 0.5s. If what I've done works, I'll try speeding up the strobing at faster speeds until you can't see the strobing whilst it's being swung around. More than likely thought, this won't work the first time.. keep your fingers crossed please!
PICs + LEDs are fun! I've been playing with a little project for writing msgs using just persistance of vision lately, quite cool, so far i can write Animus nicely, only problem is i want the chip to do the maths to determine how fast your waving it on the fly using the cheapest possible tilt sensor! I found that getting a dim colour when the LED is been moved at high speed very challenging (heck i gave up, and put in 3 levels of resistors!). I am still trying to think of a more elegant solution (one was using the built in pull up resistors!) when i do i will let ya know!
I have got, somewhere, a full software 3 channel 8 bit PWM code for PIC16. If anyone is interested, I'll see if I can dig it out, but I'll warn you that it's a right mess and eats up about 75% of CPU cycles.
Sounds interesting.. what frequency does it's output run at? That's the real limiting factor in this application. It's going to have to be a pretty high value.. at least that's what I reckon From a previous post of mine :
I think i posted in this thread earlyer the easyest way of getting 8-bit PWM from software for as many pins as you like, but it assumes you have a spare timer interupt. you just test the value of the TMR set to auto increment, test against a value for your pin, if it overflows, set that pin high. so its like CLRF PORTATMP MOVLW 0x80 ; on half the time ADDWF TMR0, W BTFSC STATUS, C BSF PORTATMP, 1 MOVF PORTATMP, W MOVWF PORTA if you want the pin to be on 1inFF times, then just make it 1! and so forth. 8 bit, very nice, but oh dear, only 8 distinct values. I've got some code which i will dig out later today (hopefully) that allows you to control this software PWM via the comm port, also got a VB app that lets you use a scroll bar to choose the luminosity. But its somewhere on the archive computer.
Right, it seems my assembly skills are lacking. I've set up as much as I can see is necessary, but I'm not seeing the blinking LED I was expecting. I'm using a PIC18F1320. I've tried to set the thing up to use the 8MHz internal oscilator. Here's my ASM file / workspace (hacked from one of hazer's tutorials) : hyperlight.zip And here's the config : I thought that it ought to switch on / off an LED on RA0 every 0.5s. As for my circuit, I'm running 5v into pin 14 (Vdd/AVdd) and gnd to pin 5 (Vss/AVss). I've got the LED connected to RA0 via a current limiting resistor. I've no doubt missed something, so what d'you suppose it is?