Many thanks for that, Had a quick look at the link ..looks just the thing I wanted, Bit late to study now, bedtime & just got in from g daughters school musical. Age ? put it this way, Faraday hadn't satrted shaving when I got into this game and I aint going to seeing the good old three score years and ten again so its good to be helped by all you patient youngsters ! Thanks again !
Hi again,
Got the porta I/O proble sorted insofar as i can now switch on any of the a port bits and light an led. Or so I thought, I wrote a program which switched on each bit of the port in turn held it with a pause 500 command and then switched it off and so on. When writing te Christmas star program I wrote simple code tp switch on all of the bits of PortA (they are each connected through Darlingtons to the - line of one of 16 arms (the other 8 are driven from portc by identical code (other than the port id). Now what happens is that only pins 4 6 and 8 remain high (leds lit). I have now written a separate little piece of code to test it. If I switch each pin on in turn pausing between each one (but not switching them off ) then led 0 switches on and after the specified delay it switches off and the next one comes on. only when I get to pins 4 6 and 8 do they stay switched on. Another curiousity which may be a clue is that when I compile and program the pickit2 comes on with a lower Vdd(about 3.8 and I have to turn it up again. I have also removed the darlingtons so there are only leds an port A but it has made no difference. If anyone can spot whatever my latest stupid mistake is I would be very grateful. BTW the reason I could'nt originally use pins 6 an7 was that [I] had my knickers in a twist thinking I was programming with MPASm when in fact I was using the default !!
Hi David,
Let's have a look at your code, and schematic, if you don't mind. What is wired on those ports (as leftover from the demo board's orig.) ? Anything?
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi
Before I post the code I seem to remember that there is a particular etiquette for including code in a post but I can't find any reference to it. Just thought I'd ask as I dont want to upset folk . Thanks
Code tags work well.
http://www.picbasic.co.uk/forum/misc.php?do=bbcode#code
Makes thing a little more readable.
Dave
Always wear safety glasses while programming.
Thanks for that.
My original circuit had three octal darlingtons (ULN 2803) with inputs directly coupled to Ports A, C and D I have also connected leds with 680ohms to each pin so that I can see what the ports outputs are. A test program switched on and off each led in turn thru ports D C and A in that order and worked OK. Problem arose when tryin to switch on all of the A port bits and leave them on. I have now disconnected ther darlington from port a and written the following simple test program:
I have just run this program andCode:@ DEVICE pic16f887,intrc_osc_noclkout PORTD = 0 PORTA = 0 PORTC = 0 TRISD = 0 TRISA = 0 TRISC = 0 portA.0 = 1 pause 500 porta.1 = 1 pause 500 porta.2 =1 pause 500 porta.3 = 1 pause 500 porta.4 = 1 pause 500 porta.5 = 1 pause 500 porta.6 = 1 pause 500 porta.7 = 1 end
1. When Microcode studio fired up the Pickit2 the voltage Vdd had been set down to 3.3
2. I turned up Vdd to 5 volts and programmed the chip.
LEDs 0,1,2,3 tuswitched on and then off after the delay. LED 4 switched on and stayed on, LED 5 switched on and then off again after the delay and then LEDs 6 and seven switched on and remainedon. I can see no logic inthis although I have that horrible feeling that it is staring me in the face !
Bookmarks