Browsing Posts published on 16/11/2011

Interrupts are go! 16/11/11

Just a few minutes ago, I soldered the last joint to a little ‘flying board’ I’ve built that connects into the original PIC programming board we bought all those months ago.

For reason known only to the Velleman designers, they’d put the main interrupt input pin as an LED output, but this hasn’t stopped me.  That link above takes you straight to the page of said programmer.

I unhooked the resistor feeding the little LED and connected one of the three flying leads (…the other two are +5 volts and ground…) so the new circuit was fully connected.

I then turned it on, and…

IT ONLY WORKED!

Shouts of disbelief as again and again I touched a wire across the two terminals and two LED tell-tales faithfully lit up twice to show me that yes, it had gone into the Interrupt Service Routine (ISR) and yes, it had taken notice and to prove it they lit.

Thankfully, I was fully dressed at the time, so couldn’t do the full “I’m Too Sexy For My Cat” dance routine, but this was probably for the best.  There were mothers and small children walking past, and I wouldn’t really have enjoyed explaining ISR’s and LED’s to our friends in blue ‘down the yard’.  Methinks they wouldn’t have quite understood the intricacies of it all.

So, the next step is to neaten up the code then build the first seven segment display board so when the bike wheel clicks, there’s a display you can refer to.

Of course, at first this will just be numbers that don’t actually mean anything, but very quickly -thanks to the math routines embedded within ‘C’- I’ll be able to make it display in Kilometers.

Then its the small matter of providing a speed output, but as that involves using the timers on the PIC, well, that’s for another day I feel.

In the meantime, the Wardian Household tonight is a happy place, and Heaven knows, we need all of those we can get right now.

More soon.

PIC-ing like crazy. 16/11/11

You may have wondered just what has happened to the much-trumpeted project of a few months ago; namely the Plot Power Project and the electric bikes we were getting all in a fizz about.

Well, Dear Reader, you can wonder no more!

Now the growing season has just about finished and the utter circus that was Allotment Soup is finally out of the way, along with those three major projects, I’ve gone back to the bikes with renewed vigour.

Well, I think its vigour, because once again its keeping me awake at nights.

‘So whats the latest??!!’ You scream.

Well, things have definitely moved on.

Whereas before we were using PIC assembler language (PIC ASM), now we’ve had to move on to ‘C’ for the PIC.

We’ve had to do this because the maths required has just leaped up a notch as we implement the distance traveled and mean speed functions.

For those not in the know, assembler is the real nuts-and-bolts, individual bits and bytes control; ‘C’ allows for more ‘English’ looking and reading code.

For those of a certain age, it looks and reads a little like the BASIC of old so favoured by the BBC B and ZX81 micros but with added refinements.

There were, of course problems with this.

Firstly, getting the ‘C’ compiler to bolt-in to the Microchip Integrated Development Environment (IDE) was a nightmare.

Then, there was the problem that Hi-Tec who produce the compiler have released virtually no how-to manuals, so you’re on your own!

Anyway, I’ll not bore you further dear reader until I have some pretty photos of it in the coming days.

Suffice to say, the other night, I got an LED to flash with a ‘C’ program, so now I just have to get the interrupts working, and we’re away.

So close, and yet so far…

 


SEO Powered By SEOPressor