My PICkit 2 PORTB outputs do not consistently pull up the coils in the DPDT relays enough to activate them.
The 16F887 outputs measure 2.8v to 3v when driving a coil. I did not find mention of this potential problem in the PICkit2 Manual.. Any ideas anyone?
Is there another Microchip kit that has some output drivers?
Ken
According to the data sheet, the output high voltage is VDD-0.7 (4.3V with 5V supply) when sourcing 3mA. The absolute max. current sourced/sunk by any I/O pin is 25mA. What does your relay require to activate?
My ZETTLER AZ8222-2C-5DSE spec says:
Nominal Coil VDC 5 volts
Coil Resistance 125 ohms
Must Operate VDC 3.8 volts.
3.8/125 = 30ma
One relay works out of six when driven by a PORTB output.
NUTS!
Ken
The current being drawn by the relays is pulling down the voltage to <3V. You need to use a driver (or low VceSat transistor or logic level MOSFET).
Keep in mind also that even though each port pin is rated at 25mA maximum, the maximum TOTAL rated current into Vdd or out of Vss is only 95mA.
So even if your relays only draw 20mA, which is within the limits of each port, you could only run 4 of them at once without exceeding the TOTAL current draw through Vdd, because of the 95mA limit.
Like RMTEO said... some nice logic level MOSFETS on the low side of your relay coil is what you need now...
steve
Does MICROCHIP make an auxiliary board that contains drivers for the PICkit 2 device? I am not capable of soldering onto that PICkit printed circuit board. I already have a good sized non-solder proto board carrying the four DPDT switches, two proximity sensors and a voltage regulator. I am trying to get this whole thing onto a 1/10 scale radio control car.
The guy from whom this idea came used a PICAXE.
Ken
There are more logic level MOSFET's than Carter has Liver Pills (an expression that easily shows my age).
What I want to do must be very standard.
Suggestions?
Ken
http://www.fairchildsemi.com/ds/FD%2FFDD8424H.pdf
I find these handy. Mouser has them.
Dave
Always wear safety glasses while programming.
Just to confuse the issue a tad more, one of the other options would be to use a buffer/driver IC like this:
http://focus.ti.com/lit/ds/symlink/sn7407.pdf
Digikey has 'em for under $2, and it gives you up to 6 outputs if you like. MAX current is 40mA.
I did a quick search for nice little MOSFETS in a small through-hole style package (like to-92) and I've gotta say it's pretty depressing. 98% of the stuff out there these days is SMD.
Dave, those little dual MOSFETS are cute. But I'll bet Ken would like something in through-hole...
steve
I grabbed my "TTL Integrated Circuits Catalog From Texas Instruments" dated 1 August 1969 and found specs on the SN7400, SN7401, SN7402, SN7403, SN7404, SN7405, and SN7410!!
This SN7407 thingie must be one of those newfangled inventions. No wonder I did not recognize it
Thank you all!!
Heh, you've got me beat for "vintage databooks".
I've got some National Semiconductor "TTL" and " Analog" data books that go back to '74, and a Signetics data book from '76, but nothing that goes back to the 60's...
Hey, It's 2010 and that means the NE/SE555 is celebrating it's 40th birthday!
Am I the only one that finds that amazing? 40 years in production for an IC type..
According to Wikipedia:
"As of 2003, it is estimated that 1 billion units are manufactured every year." Wow!
Sometimes technology doesn't change that much, it just gets... smaller.
Oooh look, now available in a TSSOP8 package.
http://www.st.com/stonline/products/...4077/ts555.pdf
You're doing great Ken, and I'm looking forward to seeing photos of your car in action because I know you're going to get there. You're clearly a geek at heart with experiance behind you ...
You just need some fresher data books to work from.
You're doing great. Carry on.
steve
Sends you on a nostalgic trip, doesnt it?
My dad used to work in the avionics department of our national carrier, and I remember he showed it to me as an example of cutting edge technology.
Of course, I could only appreciate the significance after he showed me the equivalent transistorised module it replaced.
"What will they think of next..."
Regards,
Anand
Ok, this pretty off topic, but since we are going down memory lane...
I still have my first development board, a 6950 Intercept Jr from Intersil (later bought out by Harris I think). Actually, it's not too shabby for 1976. Battery powered, 12 button input that allowed assembly programming via push buttons, 4 digit address, and 4 digit memory display. Though it is about 1 square foot in size, and the extra $145.00 for 1024 words of ram is a little steep. But I guess I was a slow learner, because the promise of "teaches you the basics of microprocessors, random access memories, read only memories, and input and output interfacing in less than 8 hours", took a little more time for me.
Last edited by ScaleRobotics; - 13th February 2010 at 19:58.
Where do I find how to interpret the following .asm code? It is a piece of the wall_racers.asm file which was created when I compiled wall_racers.bas. If I am going to figure out exactly what my code is doing I need to be able to parse it. How do I do that?
; C:\PK2LES~1\44PIND~1\WALL_R~1.PBP 00132 if rangeright < desiredtrack and oldrangeright < rangeright then
CMPLT?WCB _rangeright, _desiredtrack, T1
CMPLT?WWB _oldrangeright, _rangeright, T2
LAND?BBW T1, T2, T2
CMPF?WL T2, L00005
I looked in all the Microchip documents I have for "CMPLT" and "WCB".
Where are these defined?
Also how, using PICkit 2 Programmer do I read contents of RAM addresses 40, 42 and 44??
Ken
Let me see wall_racers.bas and I will try to tell you what it does.
The basic code will be much easier to read.... One of the reasons basic is used???
Dave
Always wear safety glasses while programming.
My problem is that the code is not doing what I think it should be doing.
I have put LED blinkers at the beginnings of all subroutines. That way I can tell the path the code is taking. You understand, I have not been able to get MPLAB IDE to work at all. That is the tool with the debugging features. I am using PICkit 2 Programmer and my own ingenuity.
It looks like some arithmetic on the PULSIN results is not working correctly. I do not know how to read the VAR which stores the pulse size in units of 10 usec. I would like to see exactly what the PIC thinks it got, but that means reading RAM. I would like to put a break point in the code and read certain addresses at that point, but I have not been at all successful with that technique.
I planned, but did not get to it, to enter a Microchip FAQ forum to see what they all say about these two Microchip software products working together.
I'm tired. It is bed time. Thanks. Maybe things will be more clear in the morning.
Ken
Here is the link: http://letsmakerobots.com/node/928
It's in Picaxe basic. Not sure how compatible that is... never tried any picaxe here. Picaxe appears to be built for 4mhz or 8mhz depending on the product.
Ken, beyond any possible incompatibilities with the code, are you sure you are running at the proper speed? That would throw your measurements off as well. Since PBP defaults to 4mhz, try 8mhz and see if it is any better, if not probably a code incompatibility, or a config setting that is already set to something for the Picaxe, and you need to try to duplicate.
Again, I have no experience with a picaxe, and had to do a search to find out what it was. Anyone have some Picaxe insight?
See here PICAXE
I should have said to Ken, "Lets see your version of wall_racers, because you would have had to re-write it for PBP"
So....
Ken, post your code!!!
Dave
Always wear safety glasses while programming.
I need to clean it up a bit.
Yes, I did modify the original PICAXE basic to comply with our PCP rules. There were a couple of specification differences and there were a couple of typo's. My code compiles fine and runs OKAY. The flashing LED's tell me alot.
Last week I focused my attention on making the DC motor and Servo work. I am now anxiously awaiting the arrival of ten SN7407N (all for $5.00! plus shipping)
Now my focus has been on the arithmetic the code applies to echo pulse responses from the SRF05's. I am trying to reconcile what the code does with the SRF05 spec which reads:
My last post was just looking for information. Is there no way to read RAM from the PICkit? Is there no way to put a break point in the real code?The SRF04 provides an echo pulse proportional to distance. If the width of the pulse is measured in uS, then dividing by 58 will give you the distance in cm, or dividing by 148 will give the distance in inches. uS/58=cm or uS/148=inches.
I'm going to try to better understand MPLAB IDE. It has a debugger mode.
Thanks, Ken
Thanks
I have been trying to activate PICkit2 Debugger per instructions in Chapter 4 of the PICkit 2 User's GUIDE DS51553E
I could not activate the project using 16F887Demo.asm per the User's Guide because my copy of that file is empty. Strange.
I could not activate the project using wall_racers.asm. Each time I hit "Build all" it considered for a few moments then in RED LETTERS said BUILD FAILED. No explanation. No comments. No helpful information.
I succeeded in activating a debug project using blink.asm from C:\PBP\PK2 Lessons\44 Pin Demo Board\02Blink.
I have not the faintest idea what I have learned with this exercise. I know from the listing file which RAM locations I wish to read. I think I could figure out where to place the break point if I could get the debugger to accept the wall_racer.asm code.
Ken
Ken
Rename "wall_racers.bas" to something with 8 characters or less then start over with compiling and building.I could not activate the project using wall_racers.asm. Each time I hit "Build all" it considered for a few moments then in RED LETTERS said BUILD FAILED. No explanation. No comments. No helpful information.
MPLAB does not like long file names.
Try "racer.bas"
Dave
Always wear safety glasses while programming.
Thanks macracket. Shortening the name made MPLAB happier. It actually tried to build my PBP code, but was very unsuccessful. Understand this is exactly the code that can be built, downloaded and run by PICkit 2 debugger software.
MPLAB is not happy with the formate of the .asm code created by PBP. Below is a small snip of a huge list of complaints.
It would appear that PBP folks don't use MPLAB. True?Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 235 : Illegal opcode (_blinkloop45)
Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 238 : Illegal opcode (_rangefront)
Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 241 : Illegal opcode (_blinkloop67)
Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 244 : Illegal opcode (_turnon)
Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 247 : Illegal opcode (_steerto)
Warning[207] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 250 : Found label after column 1. (GOTO?L)
Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 250 : Illegal opcode (_main)
Warning[207] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 253 : Found label after column 1. (LABEL?L)
Error[122] C:\PK2 LESSONS\44PIN DEMO BOARD\RACERS\RACERS.ASM 253 : Illegal opcode (L00001)
Ken
MPLAB is used by PBP folks often. I use it about 25% of the time. MCS about 25% and gEdit(Linux) the remainder.
Have you picked the correct PIC in MPLAB?
Post your code and I will check it out here if you want.
Dave
Always wear safety glasses while programming.
If I write in the C language provided by Microchip would the MPLAB ICD work better? I do wish I could see what is going on....
Ken
macracket,
Is it OKAY to post 371 lines of code on these forums? It is the copy that compiles, builds and works. However, it has comments, reminders and unnecessarys.
Maybe I should email my code to you.
Ken
Rename the file as a txt and attach it to the thread.
Dave
Always wear safety glasses while programming.
Here is the file that I have been compiling with MicroEngineering MicroCode Studio PICBasic Pro compiler, building with MPASM and programming with PICkit 2 successfully.
The assembly language result from this MicroCode Studio compile is not acceptable to the Microchip PICkit 2 Debug Express MPLAB IDE.
It says in RED "BUILD FAILED"
OH! I see now. It is complaining about PBPPIC14.LIB lines 607, 623, 640, 643, 649 etc.
These are all "if" statements that look like this:
7785 if ($ > 800h)
541 if ($ == (Label))
552 if (((Label) & 800h) == 0)
559 if (((Label) & 1000h) == 0)
705 if ((Label) > $)
722 if (((Label) & 1800h) == 0)
725 if (((Label) & 800h) == 0)
731 if (((Label) & 1000h) == 0)
607 if ((Label) < 1)
623 if ((Label) > $)
640 if (((Label) & 1800h) == 0)
643 if (((Label) & 800h) == 0)
649 if (((Label) & 1000h) == 0)
677 if ($ == (Label))
689 if ((Label) < 1)
Hundreds of:
Followed by:Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F887 "racers.asm" /l"racers.lst" /e"racers.err" /o"racers.o" /d__DEBUG=1
Error[151] C:\PBP\PBPPIC14.LIB 7785 : Operand contains unresolvable labels or is too complex
Error[151] C:\PBP\PBPPIC14.LIB 607 : Operand contains unresolvable labels or is too complex
Error[151] C:\PBP\PBPPIC14.LIB 623 : Operand contains unresolvable labels or is too complex
Error[151] C:\PBP\PBPPIC14.LIB 640 : Operand contains unresolvable labels or is too complex
Error[151] C:\PBP\PBPPIC14.LIB 643 : Operand contains unresolvable labels or is too complex
It appears that all I need to do is to figure out why this .lib file is incompatible with MPLAB IDE....Error[151] C:\PBP\PBPPIC14.LIB 559 : Operand contains unresolvable labels or is too complex
----------------------------------------------------------------------
Debug build of project `C:\Pk2 Lessons\44Pin Demo Board\racers\racers.mcp' failed.
Language tool versions: MPASMWIN.exe v5.35, mplink.exe v4.35
Preprocessor symbol `__DEBUG' is defined.
Tue Feb 16 20:56:41 2010
----------------------------------------------------------------------
BUILD FAILED
Hmmmm....
Ken
All I have to do is replace all the instances of '(Label)' with 'Label' in PBPPIC14.LIB
But how did it get that way in the first place?
Ken
I changed this line
TOCode:loop while rangefront > frontfreetostopreverse and rangeright > outertrack and b0 < 20
Because I am still using PBP 2.50Code:while rangefront > frontfreetostopreverse and rangeright > outertrack and b0 < 20 WEND
I compiled in MCS then created a project in MPLAB using the ASM from MCS work as the source.
No problems here.
Just wondering if you are selecting the correct PIC???
Dave
Always wear safety glasses while programming.
macracket:
I changed the do loop to a WHILE WEND loop. It compiled fine, but still would not assemble in the MPLAB Debugger. Same problem with the PICPBP14.LIB "if" statements. How can the .LIB files be at fault? Very strange. Sounds like some kind of compatibility problem.
Attached is my Device Select 16F887 Window. It looks a little more flexible than yours, but basically the same
Hi all
Thought this might be of some interest, the code is in C and there is no schematic , was just thing of 4 well synchronized hard drive spindle motors a an RC chasis , would be quite a fast car.
Seems like a nice project though!
http://bradthx.blogspot.com/2010/02/...le-motors.html
Kind regards
Dennis
Ken,
Just to be sure we are all doing the same thing...
1-- Write and compile the code using MCS.
2-- Generating the ASM file with MCS set for MPASAM use.
3-- Open a project in MPLAB.
4-- Use the ASM file generated by MCS as the source for the MPLAB project.
5-- Everything is in the same project directory.
Dave
Always wear safety glasses while programming.
1-- Write and compile the code using MCS.
Compile PIC BASIC PRO code using
MicroCode Studio version 3.0.0.5
PICBASICPRO 2.6.0
2-- Generating the ASM file with MCS set for MPASAM use
Using MPASM per the following picture:
3-- Open a project in MPLAB.
Open the project in MPLAB IDE 8.43.00.00
MPDebugger 3.10
4-- Use the ASM file generated by MCS as the source for the MPLAB project.
5-- Everything is in the same project directory.
Looks like the only difference is you are using the latest software, I am still using PBP2.50 and MPLAB v8.00.
So I am at a loss now.
Dave
Always wear safety glasses while programming.
Progress has been slow. It will be more fun when the SN7407's show up and I can make the car move.
Ken
It's been more than a week. They were supposed to have been shipped via USPS. The vendor is not answering its email. Does not look good.
Meanwhile I might as well get back to the REAL project. I have not decided on the least intrusive means to generate PWM. Using the toy level car all I have is bang/bang control. Full speed forward, full speed backward, stopped. Full turn left, Full turn right, straight ahead.
With PWM control I have CONTROL. Thing is, I do not know whether I really need this complication. Probably not. But I do need for the microprocessor to be doing things while the car is moving. PAUSE does not cut it.
Gotta put back on my thinking cap.
Ken
Bookmarks