Sunday, 10 March 2013

PIC Programming.....


Whilst I wait for my latest order from Farnell I decided to get a program onto the PIC, initially for test purposes. I read loads of info on the web relating to the K150 PIC programmer I bought from Ebay for £7.

It doesn't seem to be natively supported by MPLAB IDE, but it can accept a HEX file produced by MPLAB.

On the website below there are some example programs in assembler for testing the PIC. I have a 16F88.

http://files.winpicprog.co.uk/


I wrote a very simple program in C to send 2 5V square waves, 180deg apart for use in testing the ringer. One problem I encountered is that I could not get the __delay_ms() function working and in the end I wrote my own delay loop. The values for this were  a bit of a guess as I can set the on-board click speed to say 4MHz, but how many cycles to wait is a bit of a guess as I don't know how many instruction cycles each loop of the delay loop is taking - I guessed at 500, but I think this has given me a frequency of 10-15Hz - ideally I need 22Hz - what I need is an oscilloscope.

No comments:

Post a Comment