How do I give a radio control car autonomous control - Page 3


Closed Thread
Page 3 of 5 FirstFirst 12345 LastLast
Results 81 to 120 of 191
  1. #81
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    All the PicKit does is squirt the hex file into the PIC.

    If you want to use assembly language you can down load MPLAB from MicrChip for free.
    The language we talk about on this forum is Pic Basic or Pic Nasic Pro. One is around a $100 and the other is around $240. I think... With upgrades to new versions for $25, comes with a manual. melabs.com
    Dave
    Always wear safety glasses while programming.

  2. #82
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default MPASM I think

    I have found something called MPASM which seems to the correct acronym for a microprocessor assembler. We'll see.....

  3. #83
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    MPASM is the assembler. MPLAB is the IDE that it comes with.
    Dave
    Always wear safety glasses while programming.

  4. #84
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default More good luck for me!!

    Before we all conversed I purchased two books from amazon.com.

    Sandhu's 'Running Small Motors with PIC microcontrollers' has all its code in PIC BASIC PRO. 2000+ lines according to the cover.

    Parchizadeh and Vuksanovic's 'PIC Projects - A Practical Approach' has all its code in both assembly and C.

    Many (many!) years ago I coded in assembly language a water cooled, vacuum tube constructed architecture eerily similar to the 16F877. We developed shared symbol tables and a library of shared routines. Do these exist in the WEB based world of Microchip PIC?

    HI-TECH offers a freeware C - LITE compiler. The price is right, but this forum talks PIC BASIC. Decisions decisions...


    Ken

  5. #85
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Here is the place for ASM and C.
    http://www.piclist.com/techref/piclist/index.htm
    Start with the "Beginners Checklist" link.

    Your project would be fun to have around here but cost is cost.

    In ASM for Micros symols are not used.
    Here is an example to blink one LED with PBP
    Code:
        DEFINE OSC 20
        @ __config _HS_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    START:
        HIGH PORTD.1
        PAUSE 250
        LOW PORTD.1
        PAUSE 250
        GOTO START
    Here is an example to blink one LED in ASM.
    Code:
    ;	processor	16f876a
    	#include 	<p16f876a.inc>
    	ERRORLEVEL -224
    	; Configuration bits
    	__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_OFF & _DEBUG_OFF & _CP_OFF
    	CBLOCK 0x20   ; RAM starts at address 20h
    	d1
    	d2
            ENDC
    	org 0x0000      ; start address = 0000h	
    	movlw		B'00000000'
    	tris		PORTA
    	movlw		B'00000000'
    	tris		PORTB
    	movlw		B'00000000'
    	tris		PORTC
    	movlw		B'00000111'
    	movwf		CMCON
    	movwf		ADCON1
    	clrf		PORTA
    	clrf		PORTB
    	clrf		PORTC
    	movlw		B'00000111'
    	option
    loop:
    	bsf			PORTC,3
    	call Delay
    	bcf			PORTC,3
    	call Delay
    	goto loop
    
    ; Delay = 0.1 seconds
    ; Clock frequency = 4 MHz
    ; Actual delay = 0.1 seconds = 100000 cycles
    ; Error = 0 %
    Delay	;99993 cycles
    	movlw	0x1E
    	movwf	d1
    	movlw	0x4F
    	movwf	d2
    Delay_0
    	decfsz	d1, f
    	goto	$+2
    	decfsz	d2, f
    	goto	Delay_0	;3 cycles
    	goto	$+1
    	nop		;4 cycles (including call)
    	return
    	end
    Dave
    Always wear safety glasses while programming.

  6. #86
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default OKAY - I'm blown away.

    I hate .pdf reference manuals. I will stay with the group and purchase PIC BASIC (according to the picture it comes with both a CD and a real 20th Century paper manual). PIC BASIC LITE does not appear in the Microchip SEARCH engine. Oh, well. What's another $250? (I just paid $374 for the left tail light of my car. It comes as one big assembly. All I did was break the red plastic lens!)

    I was intimidated by the 270 page and 290 page .pdf files which purported to tell me all I need to know to write in MPASM.

    I have coded in assembly, in Pascal, in C and C++ (even fortran way back when). Never in Basic. I hope you guys a patient.

    Ken

  7. #87
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Glad to see you are sticking around.
    I have coded in assembly, in Pascal, in C and C++ (even fortran way back when). Never in Basic. I hope you guys a patient.
    Melanie is the only one to worry about.
    I hear she has a whip
    Dave
    Always wear safety glasses while programming.

  8. #88
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I got a demo C program to work

    The demo PIC Assembly programs are straight forward. I understood them. They work.

    I was happy to discover that the HI-TECH PICC lite integrates into MPLAB IDE easily. It offers a demo program that is much more complicated than the assembly shots. It worked here in sunny scenic Fitchburg Mass.

    The MPLAB IDE contains another free C compiler. We'll see what it offers.

    Ken

  9. #89
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Getting a bit frustrated.

    I ordered five DPDT relay switches early last week from Newark. They have not arrived yet. I have not prototyped a digital/analog circuit is over thirty years. We used wire wrap in the day. Yesterday I bought from Radio Shack solder, a low power iron, some small tools, and three different kinds of proto boards. It is not obvious how we physically attach capacitors, resistors, transistors, to these boards. I gather the inline chips get plugged into sockets that have pins which fit into these proto boards. Their back sides are designed for some kind of wire attachment. Wire wrap?

    Can you guys point me to some revealing photographs?

    Ken

  10. #90
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can you give the Radio Shack part number or picture of what you have?
    Dave
    Always wear safety glasses while programming.

  11. #91
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Hi Ken,
    When I build prototype projects (that aren't SMD), I usually build them on "perfboard" or "punchboard" or" Vectorboard" or whatever it's called these days.
    It's just epoxy glass board with holes punched on a .100" grid.
    Stuff the parts in from the top, bend the leads over on the bottom and solder...

    Here's a top view of a simple "vectorboard project":



    And bottom:


    That's a simple board, but I've done some pretty large and complex circuits using that method and it's worked well for me for over 30 years now.

    Put your IC's in sockets so that you can replace them easily if something "bad" happens.

    Good luck! And have lots of fun!


    steve

  12. #92
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Thanks Steve, that helps

    Thank you for the pictures. They gave me some perspective and jogged my memory.

    I bought at Radio Shack a Prepunched Perfboard (Steve's picture), a Component PC Board (780 indexed holes) and a Component PC Board (750 solder ringed holes).

    The Prepunched Perfboard is what Steve uses. Do the solder ringed holes do the same thing only easier? I gather the indexed holes work well with DIPs.

    I am looking at the PICKIT 2. I expected room for four screw sized holes to attach standoffs to hold another board. Does glue work on these boards? I've got a glue gun. I had hoped to prototype the actual RC car with it.

    Ken

  13. #93
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Schematics using CAD??

    I have a freebie copy of the CAD program Schematic Plus. I also have access to CAPTURE.

    I have not been able to find Microchip provided vector based images of their products. I would like to add the 44 pin 16F887 to my CAD library.

    Ideas?

    Ken

  14. #94
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    I would like to add the 44 pin 16F887 to my CAD library.

    Ken
    44 pin?
    I kind of assumed you'd be using a 40 pin DIP package.

    I thought all the 44 pin packages were surface mount...

    What package style ARE you using?


    steve

  15. #95
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default To get acquainted I purchased a PICkit 2

    Steve,

    I had hoped that I could prototype with Microchip's PICkit 2 Debug Express. That may not be practical.

    First off FEDEX or whatever has to deliver my PICBASIC PRO software package. Then I need the DPDT switches I'm getting from Newark. Then I need to master the programming. I want to use the DPDT switches to toggle the signals into the rear wheels electronic speed control (ESC) and the steering servo between the radio receiver and the PIC.

    I also may need two battery packs. The ESC uses a 7.2 volt Ni-Cd pack. The PIC needs a 5 volt arrangement. I could put a 5 volt regulator in front of the PIC. Trouble is the 7.2 volt batteries do not last very long when at the track. Two voltage sources would be preferable but more difficult to physically install.

    I need to be able to draw a schematic. The PIC will control the DPDT switches guided by a binary (PWM?) signal from the third channel in the RC system. The PIC will also have to react to whatever sensor interrupts (light for one and maybe touch in front) as well as generate steering and ESC signals when autonomous.

    The RC racing will as original. Its speed and flexibility will not be compromised. Autonomous mobility can be slower. It is still part of the race, but speed will be less important than good programming.

    It would be nice to program the autonomous actions with a simple language like LOGO or ROBOlab or whatever is used for VEX. I have not the faintest idea how to accomplish that without direct help from one of those organizations.

    Little by little with you guys help==>

    Ken

  16. #96
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I'm ready to roll

    My PICBASIC PRO arrived today.

    I have gotten more confidence by going down the paths suggested in:
    http://letsmakerobots.com/node/928 There are some pictures of prototyping.

    I might use a cheap RC car to start. One that has no electronic speed control unit and whose steering is done by a motor, not a servo.

    I need hook up wire (Radio Shack).

    I have no oscilloscope. All I have is a very old multimeter. Good enough?

    Ken

  17. #97
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Problems in River City

    Steve,

    I am planning to prototype with the PICkit 2 Debug Express. It has a 44 pin surface mounted PIC. I will use hookup wire to jump from the PICkit board to my perfboard. If I blow the PIC a new board costs less than $25.

    I am having trouble getting my new PICBASIC PRO software to work. It can compile, but not program. It can not find a programmer application. Maybe I should uninstall the software that came with my PICkit 2 Debugger Express. What do you think?

    I am not sure how to proceed. The manual does not give any help.

    KEn

  18. #98
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yes, install the PicKit software
    Load the HEX into it and and click write. You can turn the power on and off from there also.
    There should be a PDF manual with the PicKit or you can get it from Micrchips web site.
    Dave
    Always wear safety glasses while programming.

  19. #99
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Yep, like Dave sez... load up the PICKit software.

    The user guide for the PICKit should get you started.

    Then it's time to start writing soem simple programs like "Blinky LED" to get a feel for how stuff works.

    That 16F887 should be great for your little car. Lots of I/O, 2 HPWM channels, plenty of pins that support ADC to read your sensors.

    You mentioned earlier that you have no 'scope, just an old voltmeter. That should be fine for most troubleshooting. You might want to watch Craigslist or Ebay for a used scope. For low speed stuff you can also use a voltage divider on the microphone input of your soundcard, and use a program like Audacity or similar to capture your waveforms for viewing.

    You're gonna have fun. Load up that PICKIT software and get it going!


    steve

  20. #100
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default My problem is not PICkit software it is PICBASIC

    Guys,

    Last week I had PICkit Assembly code and HI-TECH C code working.

    I plucked down $250 for PICBASIC. This is what is not working. It compiles but refuses program. It says that it can not find the programmer. I think its programs are duplicates of what came with the Debug Express package. Some how they are getting confused.

    I have a second RC car. It is toy level. Both drive wheels and steering are driven by motors. It is easy to control such a car by PIC. All it needs to do is ON and OFF forward, ON and OFF reverse, ON and OFF steer left, ON and OFF steer right. OFF + OFF makes it steer straight. The steering mechanism has a physical limit mechanism. Controlling the above can be done with four DPDT switches. The car carries 7.5 volts worth of AA batteries.

    Back to getting PIC BASIC working..

    Thanks,
    Ken

  21. #101
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If the code is compiling look in your project directory for a HEX file. If one is there then MCS and PBP are working. I would not bother with trying to get MCS to run the PicKit2. Use the PicKit2 software for putting the code in the chip.

    Make sure each project has a directory of it's own.

    So let us know if you have a HEX file after you hit F9 in MCS.
    Dave
    Always wear safety glasses while programming.

  22. #102
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    It is easy to control such a car by PIC. All it needs to do is ON and OFF forward, ON and OFF reverse, ON and OFF steer left, ON and OFF steer right. OFF + OFF makes it steer straight. The steering mechanism has a physical limit mechanism. Controlling the above can be done with four DPDT switches.
    Hmmm. Just off the top of my head, I should think you'd only need 2 DPDT relays (1 for forward/reverse, 1 for left/right) and 2 SPST relays, one to turn power on and off to each motor.

    Actually, since your 16F887 has 2 HPWM channels, all you need are the 2 DPDT relays for forward/reverse and left/right, and 2 MOSFETS, one on the "low side" of each motor. Now you can use your HPWM channels for ON/OFF control with the added benefit of having SPEED CONTROL on both motors!

    Change your motor speed with a single line of code!

    Just a thought....

    steve

  23. #103
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I am upset!!

    I was doing fine with Assembly and HI-TECH C code.

    I thought it would be best to go for PICBASIC. I could not find on the Microcode WEB site the $100 PICBASIC product. The only thing available is the $250 PICBASIC PRO package.

    It does not work at all!!

    The paper manual is useless regarding installation. For example one of the installation windows asks me if I want the compiler in my "environmental path". I have not used DOS since the 1990's. Frankly I forgot what my environmental path is, er was... No comment on this in the Copyright @2009 microEngineering Labs, Inc. manual

    I installed everything. It could not find the compiler.

    I uninstalled everything Microchip. MPLAB ide V9.30 refused to uninstall per my XP "remove program" feature. I finally deleted the whole C:\Programs Files\microcode directory.

    Then, with only the PICBASIC disk in my CD reader I installed PBP again.

    All seemed OKAY until I tried the simplest of tests - write, compile and build BLINK.BAS.

    I succeeded in moving BLINK.BAS into my workspace. The COMPILE and BUILD said,

    "Could not spawn language tool. Check command line options (5)"

    What th' ?? The free software has been easier to install and understand and better documented than the $250 package.

    Any idea in my computer where there is a file that will explain that compiler comment?

    Ken

  24. #104
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can you tell us exactly what does not work? Do not take this the wrong way. Ut it could be a number of things.

    For starters you said in another post that the code compiled. Now it does not work at all???

    Are you using Micro Code Studio for the code editor?

    And who is "Microcode WEB" ? I hope you did not buy from someone that is not authorized.
    Dave
    Always wear safety glasses while programming.

  25. #105
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Ken,
    I did not mean to sound harsh in the above post.

    I will pit together some screen shots tonight to help you get started.
    Make sure you have Pic Basic Pro, Micro Code Studio and MPLAB installed in the default directories and we will get you going. They should all be on the Pic Basic CD.

    What operating system are you running ?
    Dave
    Always wear safety glasses while programming.

  26. #106
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Here's what is happening

    First I loaded the MPLAB code that came with PICkit 2 Debug Express. This was version 80. I also loaded Hi-Tech's C lite (free) C compiler.

    Every thing worked beautifully. I got an Assembly language bit to work and I got some C working. Both were examples that came with the package.

    Then I purchased PICBASIC PRO. Unbeknown to me this CD also had a MPLAB. It is version 83. I did the SETEUP.EXE from the PBP CD. Everything seemed hunky dorry until I tried to do a BASIC program per the manual. No good.

    I noticed that now two MPLAB's were installed on my machine. I tried but could not get the WINDOWS XP program remove tool to uninstall MPLAB version 80. Since then nothing has worked correctly.

    I have just done a complete new install with everything in their default directories. Let me see what is what.

    Ken

  27. #107
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Ok, I am not home yet but maybe we can go ahead.

    Do you have Micro Code Studio installed? If not install it. Leave MPLAB alone and installed for now. You will need a part of it.

    Use for now MCS for your code editor.

    When you start MCS under the view button on the toolbar there will be compiler options. On the first tab tell it to find PBP if it has not already done so. On the second tab tell it to find MPASM there is a check box. Do not worry about the third tab.

    Now when you want to compile hit the F9 key. If no errors are found it will generate a HEX file.

    More later.
    Dave
    Always wear safety glasses while programming.

  28. #108
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Here are a few screen shots that might help..
    This is the first thing you need to do when starting MCS.


    Then on the first tab click "Find Automatically". It should find PBP in the root directory. Do not check "Use PBPL", that is only good for 18Fs.


    Then on the "Assembler" tab check "Use MPASM" and click "Find Automatically". Check the other radio buttons as shown.


    Now you will be able to hit the F9 key to generate the *.hex file. Use the PicKit2 software to program the chip.

    Let us know your progress.
    Attached Images Attached Images    
    Dave
    Always wear safety glasses while programming.

  29. #109
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default OKAY so far...

    Thank you!!!!

    I have successfully done all so far. Is there someplace I could have/should have read this? It certainly is not in the paper manual that comes with PICBASIC PRO.

    I gotta go. Will be back later in the day.

    Ken

  30. #110
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I am not sure where this is all documented anymore. The PBP manual deals with the command line for compiling, PBP is a command line program.

    Now that you are getting HEXes. Start the PicKit2 software.
    After it starts if you do not have it connected to a PIC or you change PICs you will need to check communications.


    Then import the HEX.


    Click the "Write" button to squirt the HEX to the PIC.

    Now to make this automated click the "Auto Import" button. This brings up the open dialog to select a HEX. If you do this, each time you compile by hitting the F9 key in MCS the PICKIT2 software will re-load the HEX and write the PIC. The power can be turned ON/OFF with out changing the settings. Click the "Auto Import" again to go back to normal.
    Attached Images Attached Images    
    Dave
    Always wear safety glasses while programming.

  31. #111
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Idiosyncrasies

    So far, so good.

    Interesting little issues.

    ONE, I tried to compile the BLINK.BAS that comes with Microcode Studio. It contained the placer "loop:". The compiler did not like that. It asked for a "do". I edited it to "mainloop". That made the compiler happy. It gave me a .hex file.

    TWO: I successfully loaded the .hex into the PIC. After the WRITE command is said Programming Successful. It does not run at all. No blinking of the LEDs. I asked for a verification of the program load. It said, "Verification Successful" I visually checked program memory against the .hex code. It downloaded correctly. Hmmmm...

    Guess I gotta learn how to use the debugger.

    One more thing. The Microcode Studio compiler accepted 16F877 as the PIC. The PICkit 2 PRogrammer insists it is a 16F887. It gives me no choice. All I can select is Midrange/Standard Configuration.

    Here is the BLINK.BAS that It compiled without complaint. I better go check the wiring. Maybe there is no LED atached to PORTB 0

    '************************************************* ****************************
    '* MICROCODE STUDIO TIPS *
    '* *
    '* (1) : To get context sensitive help, move your cursor to a PICBasic *
    '* : command and then press F1. *
    '* (2) : Program assumes the PIC is running at 4MHz. To change the default *
    '* : setting (for example, to 20MHz) simply add DEFINE OSC 20 at the *
    '* : top of your program. *
    '* *
    '* This sample program is supplied courtesy of microEngineering Labs Inc *
    '************************************************* ****************************

    ' Example program to blink an LED connected to PORTB.0 about
    ' once a second

    mainloop:
    High 0 ' Turn on LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds

    Low 0 ' Turn off LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds

    Goto mainloop ' Go back to loop and blink LED forever
    End


    Ken

  32. #112
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I am wrong.

    My magnifying glass tells me that my PIC is a 16F887.

    I'll see if that makes any difference to the compiler.

    Ken

  33. #113
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    More instructions....

    Make sure the jumper is on JP1 on your board.
    Go to your PBP directory and find the file 16F887.inc
    That is where the PIC is configured. Make it look like below, we will set the fuses in the code. See the lines that are commented with ;
    Code:
    ;****************************************************************
    ;*  16F887.INC                                                  *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2006 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 05/26/06                                        *
    ;*  Version   : 2.47                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            include 'M16F88x.INC'	; PM header
        ;    device  pic16F887, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F887, r = dec, w = -302
            INCLUDE "P16F887.INC"	; MPASM  Header
        ;    __config _CONFIG1, _XT_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    Then compile this
    Code:
    '16F887 BLINK
       @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
       
       MAINLOOP:
       HIGH PORTD.0
       PAUSE 500
       LOW PORTD.0
       PAUSE 500
       GOTO MAINLOOP
    If you board is the same as the one here...
    Dave
    Always wear safety glasses while programming.

  34. #114
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I got it!!

    The 44 PIN Demo board users guide clearly (in font size ~2 print on Page 35) says that the LED's are attached to PORTD.

    I changed the .BAS code per below and the LED blinks!!!

    ---------------start snip---------------
    mainloop:
    High PORTD.0 ' Turn on LED connected to PORTD.0
    Pause 500 ' Delay for .5 seconds

    Low PORTD.0 ' Turn off LED connected to PORTD.0
    Pause 500 ' Delay for .5 seconds

    Goto mainloop ' Go back to loop and blink LED forever
    End
    --------end snip----------------

    Hurray for our team!!

    Ken

  35. #115
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I just read what your last note.

    Thank you,

    I was looking for that include file, but could not find it.

    The printed documentation gave me the details about the board wiring.

    Onward and upward to bigger and better things.

    Ken

  36. #116
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    GREAT!!!!!!!!!!!! Glad you got it.
    Just for fun here is a "more advanced" blinky.
    You might get something out of it. You can add the comments
    Code:
    '16F887 BLINK
       @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
       DEFINE OSC 4
       TRISD = %00000000
       CNT  VAR BYTE
       MAINLOOP:
       FOR CNT = 0 TO 10
       HIGH PORTD.0
       LOW PORTD.1
       PAUSE 500
       LOW PORTD.0
       HIGH PORTD.1
       PAUSE 500
       NEXT CNT
       FOR CNT = 0 TO 100
       PORTD = %01
       PAUSE CNT
       PORTD = %10
       PAUSE CNT
       NEXT CNT
       GOTO MAINLOOP
    Dave
    Always wear safety glasses while programming.

  37. #117
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Where do I find the definitions of all those aliases?

    You used many previously defined aliases in the two INCLUDE segments as well as inside our Blink'n code;

    '16F887 BLINK
    @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF

    Where are these listed? On what page of which .pdf file?

    Ken

  38. #118
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    At or near the end of Microchips *.inc file.

    Can be found here
    C:\Program Files\Microchip\MPASM Suite

    This is the file that has pretty much everything about the chip in it.
    Dave
    Always wear safety glasses while programming.

  39. #119
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default It worked as would be expected. However

    The compiler did not like your @ line.

    It felt that three of the aliases were unknown.

    I commented out the whole line and the program compiled, programmed and worked exactly as I imagined it would.

    I guess I have to investigate the items in the @ line.

    Meanwhile I need to pick a light sensor chip for an incandescent light bulb. Got any suggestions? I have to purchase this on line. Our local Radio Shack has no such items.

    Ken

  40. #120
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Did you get an "over writing previous address" error or something like that? If so then I bet the Lines in the PBP *.inc file need commented out. But setting the fuses in thae inc is good too, personal preference kind of thing.

    Light sensors. You should get a lot of feed back on that one.

    Off the top...
    I think you said that the car was going to look for a light. You may want to think about some small solar cells. Being a voltage is produced the ADC could read them directly, well it should if it is not so low a voltage as to not have a good resolution.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Car radio (Car radio and electronics support forum)
    By freewillover in forum Forum Requests
    Replies: 1
    Last Post: - 1st July 2009, 19:41
  2. Remote Car Starter Safety
    By CocaColaKid in forum General
    Replies: 8
    Last Post: - 22nd November 2005, 09:10

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts