help re pbp3 and picket 2 with 12f675


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Apr 2012
    Posts
    8

    Default help re pbp3 and picket 2 with 12f675

    hi,

    i am a beginner and use cannot get any program to run

    i have compiled this and it complies fine, when i load the Hex file into mpelab it programs the chip but it does not run on my breadboard help

    ************************************************** **************
    '* Name : Glow Driver - 1 *
    '* Author : Ironsides *
    '* Notice : Copyright (c) 2004 C *
    '* : All Rights Reserved *
    '* Date : 07 Feb 2004 *
    '* Version : 1.0 *
    '* Notes : Turns on glow driver to glow plug at low throttle *
    '* ; An N Channel MOSFET is needed to carry the current*
    '* ; See the circuit diagram for details *
    '* Caution : Should have a safety cut off switch in the pits *
    '* : For PIC 12F675 *
    '************************************************* ***************


    ;The 12F675 has both analog converters and analog comparators.
    ;You must disable both to use the I/O pins for digital functions.
    ;In addition, the register that controls the analog converters
    ;has been named ANSEL, and it has a different format that the ADCON1
    ;register found on most PICmicro MCUs
    PCON.3 = 1
    ANSEL = 0 ;needed as as above
    CMCON = 7
    ASM
    errorlevel -302 ; Suppress message 302
    bcf STATUS,RP0 ; Bank 0
    clrf GPIO ; Init GPIO
    movlw 07h ; Set GP<2:0> to
    movwf CMCON ; digital IO
    bsf STATUS,RP0 ; Bank 1
    clrf ANSEL ; Digital IO
    movlw 0Ch ; Set GP<3:2> as inputs
    movwf TRISIO ; and set up GP<5:4,1:0> as outputs
    endasm


    DEFINE OSC4 ;sets up 4 meg internal oscillator


    GLOW VAR GPIO.2 ;Output to MOSFET driving glow driver - Pin 5
    RADIO VAR GPIO.3 ;Input from receiver - Pin 4


    P VAR WORD ; This stores the PULSIN value

    ;************************************************* ********************
    clear ; Set all variables to zero
    ;************************************************* ********************
    RX: ; This is where we wait for a signal from the Tx
    PULSIN RADIO,1,P ; With 4 meg oscillator, PULSIN measures at 10 millisecs
    IF P < 50 then goto RX ; You forgot to turn on the transmitter.
    IF (P > 100) and (P < 125) THEN GOSUB SW_ON ; Turn on glow
    IF (P > 125) THEN GOSUB SW_OFF ; Turn off glow
    GOTO RX
    ;************************************************* *******************


    SW_ON:
    HIGH GLOW ; This outputs the glow signal on Pin 5
    RETURN


    SW_OFF:
    LOW GLOW ; This outputs the glow signal on Pin 5
    RETURN
    ;************************************************* *******************




    END ;Terminate the program

  2. #2
    Join Date
    Apr 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    hi sorry i should have added what config bits do i set to get this to work ? i am confused with these

    regards judd

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    Hi, Judd

    May be you could

    1) add

    Code:
    DEFINE OSCCAL_1K 1
    @ the top of the code

    2) Giving the link could have helped so much ...

    http://www.rc-float-flying.rchomepag...w%20Driver.htm

    shows the config is missing for GP3/MCLR ... used as an input

    so, also add @ Top for PBP3
    Code:
    #CONFIG
     __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BODEN_ON
    #ENDCONFIG
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Apr 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    Alain,

    Many thanks for this i wil try later and sorry for not including the link new at this as well
    regards judd

  5. #5
    Join Date
    Apr 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default problem with 12f675 not running

    hi

    see the ask below this complies and the hex file will program to chip, but it just will not run any suggestions?



    ; PICBASIC PRO(TM) Compiler 3.0.5.3, (c) 1998, 2012 microEngineering Labs, Inc. All Rights Reserved.
    MPASMWIN_USED EQU 1


    #define PBP_PATH C:\PBP3\








    NOLIST
    ifdef PM_USED
    LIST
    include 'M12F675.INC' ; PM header
    XALL
    NOLIST
    else
    LIST
    LIST p = 12F675, r = dec, w = -302
    INCLUDE "P12F675.INC" ; MPASM Header
    NOLIST
    endif
    LIST




    PBP_HARDWAREDEF macro
    endm




    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BODEN_ON






    ; Define statements.
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00017 DEFINE OSCCAL_1K 1
    #define OSCCAL_1K 1
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00038 DEFINE OSC4 ;sets up 4 meg internal oscillator
    #define OSC4 ;sets up 4 meg internal oscillator


    RAM_START EQU 00020h
    RAM_END EQU 0005Fh
    RAM_BANKS EQU 00001h
    BANK0_START EQU 00020h
    BANK0_END EQU 0005Fh
    EEPROM_START EQU 02100h
    EEPROM_END EQU 0217Fh


    ; C:\PBP3\PBPPIC14.RAM 00012 A00020 R0 VAR WORD BANK0 SYSTEM ' System Register
    R0 EQU RAM_START + 000h
    ; C:\PBP3\PBPPIC14.RAM 00013 A00022 R1 VAR WORD BANK0 SYSTEM ' System Register
    R1 EQU RAM_START + 002h
    ; C:\PBP3\PBPPIC14.RAM 00014 A00024 R2 VAR WORD BANK0 SYSTEM ' System Register
    R2 EQU RAM_START + 004h
    ; C:\PBP3\PBPPIC14.RAM 00015 A00026 R3 VAR WORD BANK0 SYSTEM ' System Register
    R3 EQU RAM_START + 006h
    ; C:\PBP3\PBPPIC14.RAM 00016 A00028 R4 VAR WORD BANK0 SYSTEM ' System Register
    R4 EQU RAM_START + 008h
    ; C:\PBP3\PBPPIC14.RAM 00017 A0002A R5 VAR WORD BANK0 SYSTEM ' System Register
    R5 EQU RAM_START + 00Ah
    ; C:\PBP3\PBPPIC14.RAM 00018 A0002C R6 VAR WORD BANK0 SYSTEM ' System Register
    R6 EQU RAM_START + 00Ch
    ; C:\PBP3\PBPPIC14.RAM 00019 A0002E R7 VAR WORD BANK0 SYSTEM ' System Register
    R7 EQU RAM_START + 00Eh
    ; C:\PBP3\PBPPIC14.RAM 00020 A00030 R8 VAR WORD BANK0 SYSTEM ' System Register
    R8 EQU RAM_START + 010h
    ; C:\PBP3\PBPPIC14.RAM 00026 A00032 FLAGS VAR BYTE BANK0 SYSTEM ' Static flags
    FLAGS EQU RAM_START + 012h
    ; C:\PBP3\PBPPIC14.RAM 00025 A00033 GOP VAR BYTE BANK0 SYSTEM ' Gen Op Parameter
    GOP EQU RAM_START + 013h
    ; C:\PBP3\PBPPIC14.RAM 00022 A00034 RM1 VAR BYTE BANK0 SYSTEM ' Pin 1 Mask
    RM1 EQU RAM_START + 014h
    ; C:\PBP3\PBPPIC14.RAM 00024 A00035 RM2 VAR BYTE BANK0 SYSTEM ' Pin 2 Mask
    RM2 EQU RAM_START + 015h
    ; C:\PBP3\PBPPIC14.RAM 00021 A00036 RR1 VAR BYTE BANK0 SYSTEM ' Pin 1 Register
    RR1 EQU RAM_START + 016h
    ; C:\PBP3\PBPPIC14.RAM 00023 A00037 RR2 VAR BYTE BANK0 SYSTEM ' Pin 2 Register
    RR2 EQU RAM_START + 017h
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00043 A00038 P VAR WORD ; This stores the PULSIN value
    _P EQU RAM_START + 018h
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00001 A0003A '************************************************* ***************
    T1 EQU RAM_START + 01Ah
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00001 A0003C '************************************************* ***************
    T2 EQU RAM_START + 01Ch
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00126 PORTL VAR GPIO
    _PORTL EQU GPIO
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00127 PORTH VAR GPIO
    _PORTH EQU GPIO
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00128 TRISL VAR TRISIO
    _TRISL EQU TRISIO
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00129 TRISH VAR TRISIO
    _TRISH EQU TRISIO
    #define _GLOW _GPIO??2
    #define _RADIO _GPIO??3
    #define _lED _GPIO??1
    #define _PCON??3 PCON, 003h
    #define _GPIO??2 GPIO, 002h
    #define _GPIO??3 GPIO, 003h
    #define _GPIO??1 GPIO, 001h
    INCLUDE "GLOWDRIVERVER2.MAC"
    INCLUDE "C:\PBP3\PBPPIC14.LIB"




    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00036 #HEADER
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00061 #CONFIG
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00119 BANK0 $0020, $005F
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00121 EEPROM $2100, $217F
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00123 #ERROR "-n option (PBPL) is not supported for this device."
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00124 #ENDIF
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00125 LIBRARY "PBPPIC14"


    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00130 include "PBPPIC14.RAM"
    ; C:\PBP3\DEVICES\PIC12F675.PBPINC 00134 #HEADER
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00017 DEFINE OSCCAL_1K 1
    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00019 #CONFIG


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00023 PCON.3 = 1
    MOVE?CT 001h, _PCON??3


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00024 ANSEL = 0 ;needed as as above
    MOVE?CB 000h, ANSEL


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00025 CMCON = 7
    MOVE?CB 007h, CMCON


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00026 ASM


    ASM?


    errorlevel -302 ; Suppress message 302
    bcf STATUS,RP0 ; Bank 0
    clrf GPIO ; Init GPIO
    movlw 07h ; Set GP<2:0> to
    movwf CMCON ; digital IO
    bsf STATUS,RP0 ; Bank 1
    clrf ANSEL ; Digital IO
    movlw 0Ch ; Set GP<3:2> as inputs
    movwf TRISIO ; and set up GP<5:4,1:0> as outputs




    ENDASM?


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00038 DEFINE OSC4 ;sets up 4 meg internal oscillator


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00046 clear ; Set all variables to zero
    CLEAR?


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00048 RX: ; This is where we wait for a signal from the Tx


    LABEL?L _RX


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00049 PULSIN RADIO,1,P ; With 4 meg oscillator, PULSIN measures at 10 millisecs
    PULSIN?TCW _RADIO, 001h, _P


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00050 HIGH LED ; SHOW PIC IS RUNING
    HIGH?T _lED


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00051 IF P < 50 then goto RX ; You forgot to turn on the transmitter.
    CMPGE?WCL _P, 032h, L00001
    GOTO?L _RX
    LABEL?L L00001


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00052 IF (P > 100) and (P < 125) THEN GOSUB SW_ON ; Turn on glow
    CMPGT?WCB _P, 064h, T1
    CMPLT?WCB _P, 07Dh, T2
    LAND?BBW T1, T2, T2
    CMPF?WL T2, L00003
    GOSUB?L _SW_ON
    LABEL?L L00003


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00053 IF (P > 125) THEN GOSUB SW_OFF ; Turn off glow
    CMPLE?WCL _P, 07Dh, L00005
    GOSUB?L _SW_OFF
    LABEL?L L00005


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00054 GOTO RX
    GOTO?L _RX


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00057 SW_ON:


    LABEL?L _SW_ON


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00058 HIGH GLOW ; This outputs the glow signal on Pin 5
    HIGH?T _GLOW


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00059 RETURN
    RETURN?


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00061 SW_OFF:


    LABEL?L _SW_OFF


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00062 LOW GLOW ; This outputs the glow signal on Pin 5
    LOW?T _GLOW


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00063 RETURN
    RETURN?


    ; C:\GCSPROGS\GLOWDRIVERVER2.PBP 00067 END ;Terminate the program
    END?


    END

  6. #6
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    Can you show your .pbp code?
    http://www.scalerobotics.com

  7. #7
    Join Date
    Apr 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    hi

    yes
    Code:
    '****************************************************************'*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2000 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 01/01/2000                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '***************************************************************
    ;The 12F675 has both analog converters and analog comparators.  
    ;You must disable both to use the I/O pins for digital functions.  
    ;In addition, the register that controls the analog converters 
    ;has been named ANSEL, and it has a different format that the ADCON1 
    ;register found on most PICmicro MCUs
    
    
    DEFINE OSCCAL_1K 1
    
    
    #CONFIG
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BODEN_ON
    #ENDCONFIG
    
    
    PCON.3 = 1
    ANSEL = 0               ;needed as as above
    CMCON = 7
    ASM
          errorlevel  -302  ; Suppress message 302
          bcf   STATUS,RP0  ; Bank 0
          clrf  GPIO        ; Init GPIO
          movlw 07h         ; Set GP<2:0> to
          movwf CMCON       ;   digital IO
          bsf   STATUS,RP0  ; Bank 1
          clrf  ANSEL       ; Digital IO
          movlw 0Ch         ; Set GP<3:2> as inputs
          movwf TRISIO      ; and set up GP<5:4,1:0> as outputs
    endasm
    
    
    DEFINE OSC4             ;sets up 4 meg internal oscillator
    
    
    GLOW     VAR GPIO.2     ;Output to MOSFET driving glow driver         - Pin 5
    RADIO    VAR GPIO.3     ;Input from receiver                          - Pin 4
    lED      var GPIO.1     ;running led                                  - PIN 7
    P        VAR WORD       ; This stores the PULSIN value    
            
    ;*********************************************************************
    clear                   ; Set all variables to zero
    ;*********************************************************************
    RX:                    ; This is where we wait for a signal from the Tx                         
    PULSIN RADIO,1,P       ; With 4 meg oscillator, PULSIN measures at 10 millisecs
    HIGH   LED             ; SHOW PIC IS RUNING
    IF P < 50 then goto RX ; You forgot to turn on the transmitter. 
    IF (P > 100)  and (P < 125) THEN GOSUB SW_ON       ; Turn on glow
    IF (P > 125)                THEN GOSUB SW_OFF      ; Turn off glow
    GOTO RX       
    ;********************************************************************
    
    
    SW_ON:
         HIGH GLOW         ; This outputs the glow signal on Pin 5
    RETURN
    
    
    SW_OFF:
         LOW GLOW          ; This outputs the glow signal on Pin 5
    RETURN
    ;********************************************************************
    
    
    
    
    END                    ;Terminate the program

  8. #8
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    If you added the LED back in, you would be able to trouble shoot it better.

    What happens if you just load the straight hex from the code example that Acetronics links to:
    http://www.scalerobotics.com

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    Hi,

    Code:
    movlw 0Ch ; Set GP<3:2> as inputs
    
    It works so much better with Port2 set as an output ....

    Alain
    Last edited by Acetronics2; - 2nd May 2012 at 11:15.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  10. #10
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    I think the original author of the code is confusing pins with port names. His drawing shows glow coming out pin 2, (GPIO5), but his code shows it coming out pin 5, GPIO2).

    Name:  glow.png
Views: 2875
Size:  96.8 KB

    GLOW VAR GPIO.2 ;Output to MOSFET driving glow driver - Pin 5
    RADIO VAR GPIO.3 ;Input from receiver - Pin 4

    Name:  pic12f675.png
Views: 1818
Size:  23.3 KB
    http://www.scalerobotics.com

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    +1 !!!

    Works fine using GP2 ... as the output.

    BTW, this design is carbon14 dated ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  12. #12
    Join Date
    Apr 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    hi all,

    thank you all for comments and help

    i have followed Alains kind advise, and if i leave out the osscal 1k 1, it works, think the pics i am using have lost the oscal setting!!, Ordered some new ones

    Alain adding the config statement got it working thank you very much.

    what does carbon 14 dated mean?. Do you have a better bit of code to do this? i would be grateful for any help i am a complete beginner at this, thank you in advance

    i did try to load the hex file but that did not run either.

    but i have finally got this working?

    thank you all it is very much appreciated

    regards

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    In this case, Carbon 14 dated mean it's been made several thousands of years ago
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Join Date
    Apr 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: help re pbp3 and picket 2 with 12f675

    Alain,

    thank you old but does the job.

    a bit like me

    regards

Members who have read this thread : 1

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

Posting Permissions

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