Announcement

Collapse
No announcement yet.

16F88 programm not working ps : I am new to the forum

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 16F88 programm not working ps : I am new to the forum

    Please I need some help my program will not work.
    it compiles without problem.

    MSC PLUS
    V 5.0.0.5
    compiler PBPX 3.0.6.4

    Pic 16f88

    '****************************************************************
    '* Name : TEST_0_16F88 *
    '* Author : [WVA] *
    '* Notice : Copyright (WVA) 2014 *
    '* : All Rights Reserved *
    '* Date : 8/18/2014 *
    '* Version : 1.0 *
    '* Notes : Testing_16F88 *
    '* : *
    '****************************************************************
    ;----[16F88 Hardware Configuration]---------------------------------------------
    #IF __PROCESSOR__ = "16F88"
    #DEFINE MCU_FOUND 1
    #CONFIG
    __config _CONFIG1, _XT_OSC & _WDT_ON & _PWRTE_OFF & _MCLR_ON & _BODEN_ON & _LVP_OFF & _CPD_OFF & _WRT_PROTECT_OFF & _DEBUG_OFF & _CCP1_RB3 & _CP_OFF
    __config _CONFIG2, _FCMEN_ON & _IESO_ON
    #ENDCONFIG

    #ENDIF

    ;----[Verify Configs have been specified for Selected Processor]----------------
    ; Note: Only include this routine once, after all #CONFIG blocks
    #IFNDEF MCU_FOUND
    #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
    #ENDIF

    OSCCON=%01100000 '4 Mh seting
    cmcon = 7 'comparator off
    ADCON1 = 7 'analog digital of
    ANSEL=0 'set i/o to digital

    'TRISA=%11111111 'all A ports inputs
    TRISB=%00000000 ' all ports outputs
    'PORTB=%00000000 'Initiate all port B pins to 'low

    main:
    PORTB.0=1 'LED on
    PORTB.1=1
    pause 1500 'Delay 1/2 second
    PORTB.0=0 'LED of
    PORTB.1=0
    PAUSE 1500 'Delay 1/2 second
    goto main 'Loop back and do it again

  • #2
    Well, It works just fine to me. You just need to add a line to define the oscillator frequency such as:
    DEFINE OSC 4
    That way PBP knows what frequency to use as a reference for statements like PAUSE.
    Dave Purola,
    N8NTA
    EN82fn

    Comment


    • #3
      thank you for your help !

      Sorry for the late response but I am not programming all the time !
      thank you for your help !
      PS : I still have the same problem .

      I changed the program
      Same result not blinking


      '---------------Title--------------

      ' File......blink1.pbp
      ' Started....11/3/03
      ' Microcontroller used: Microchip Technology 16F88
      ' microchip.com
      ' PicBasic Pro Code: micro-Engineering Labs, Inc.
      ' melabs.com

      '--------Program Desciption--------

      ' LED flashes one time per second.

      '----------Related Lesson----------

      ' blink1.pbp is used in the lesson INTRODUCTION TO PROGRAMMING 1 at:
      ' http://www.cornerstonerobotics.org/c...ogramming1.pdf

      '-------------Comments-------------

      ' Use a solderless breadboards to fabricate
      ' the circuit blink1. For a tutorial about
      ' solderless breadboards, consult the book Robot
      ' Building For Beginners by David Cook. Also see:
      ' http://cornerstonerobotics.org/curri...Breadboard.pdf
      '
      ' In-Circuit Serial Programming(ICSP): See:
      ' http://cornerstonerobotics.org/curri...rogramming.pdf

      '----------PIC Connections---------

      ' 16F88 Pin Wiring
      ' --------- ----------
      ' RB0 150 Ohm resistor to LED to GND
      ' Vdd +5 V
      ' Vss Ground
      ' MCLR 4.7K Resistor to +5 V

      '-----New PicBasic Pro Commands----

      ' The source for PicBasic Pro commands is
      ' from the PicBasic Pro Compiler Manual by
      ' microEngineering Labs, Inc.
      ' The PicBasic Pro Compiler Manual is on line at:
      ' http://www.microengineeringlabs.com/...ex.htm#Manuals
      '
      ' PAUSE period
      ' This will pause the program for a period of 1
      ' to 65,535 milliseconds or .001 to 65.535 sec.
      ' Around page 112 in the PicBasic Pro Compiler Manual
      '
      ' GOTO label
      ' Program execution jumps to location of label.
      ' Around page 73 in the PicBasic Pro Compiler Manual
      '
      ' END
      ' Stops the program execution.
      ' Around page 68 in the PicBasic Pro Compiler Manual

      '---------Revision History---------

      ' 5/24/08 Convert from PIC16F84A to PIC16F88
      ' and add 16F88 oscillator initialization

      '-----------Initialization---------

      ;----[16F88 Hardware Configuration]---------------------------------------------
      #IF __PROCESSOR__ = "16F88"
      #DEFINE MCU_FOUND 1
      #CONFIG
      cfg1 = _INTRC_IO ; INTRC oscillator; port I/O function on both RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin
      cfg1&= _WDT_ON ; WDT enabled
      cfg1&= _PWRTE_OFF ; PWRT disabled
      cfg1&= _MCLR_ON ; RA5/MCLR/VPP pin function is MCLR
      cfg1&= _BODEN_ON ; BOR enabled
      cfg1&= _LVP_OFF ; RB3 is digital I/O, HV on MCLR must be used for programming
      cfg1&= _CPD_OFF ; Code protection off
      cfg1&= _WRT_PROTECT_OFF ; Write protection off
      cfg1&= _DEBUG_OFF ; In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins
      cfg1&= _CCP1_RB0 ; CCP1 function on RB0
      cfg1&= _CP_OFF ; Code protection off
      __CONFIG _CONFIG1, cfg1

      cfg2 = _FCMEN_ON ; Fail-Safe Clock Monitor enabled
      cfg2&= _IESO_ON ; Internal External Switchover mode enabled
      __CONFIG _CONFIG2, cfg2

      #ENDCONFIG

      #ENDIF

      ;----[Verify Configs have been specified for Selected Processor]----------------
      ; Note: Only include this routine once, after all #CONFIG blocks
      #IFNDEF MCU_FOUND
      #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
      #ENDIF


      TRISB = %11111110 ' Sets up RB0 pin of PORTB as an output
      ' and pins RB7-RB1 of PORTB as inputs

      OSCCON = $60 ' Sets the internal oscillator in the
      ' 16F88 to 4 MHz

      '-------------Main Code------------

      start: ' Label for beginning loop

      PORTB.0 = 1 ' Makes pin PORTB.0,(RB0), output at HIGH (+5 volts)

      Pause 500 ' Pause 500 milliseconds (0.5 seconds) with LED on

      PORTB.0 = 0 ' Makes pin PORTB.0,(RB0), output at LOW (0 volts)

      Pause 500 ' Pause 500 milliseconds (0.5 seconds) with LED off

      GoTo start ' Jump to loop label
      ' Makes the program run forever.

      End ' This line is in case the
      ' the program gets lost.

      Comment


      • #4
        the problem is not the code, it works for me too

        does the led work ?
        is it orientated correctly ? ie cathode to ground
        do you have a resistor between pin6 and the led anode ?
        is the resistor an appropriate value ?
        is the chip powered correctly ?
        is the chip actually being programed ? and verified ?
        have you tried another pin ? another chip ? (have youmay have damaged it ... esd etc. )

        Comment


        • #5
          I did notice you have changed the oscillator to internal. If this is the actual code, You still need to set the oscillator define for the PBP compiler to synchronize the code timing's to. I would also change the pullup resistor on the RESET line to 10K as the lower value may not allow the proper reset timing required.
          Dave Purola,
          N8NTA
          EN82fn

          Comment


          • #6
            Still not working

            Originally posted by richard View Post
            the problem is not the code, it works for me too

            does the led work ?
            is it orientated correctly ? ie cathode to ground
            do you have a resistor between pin6 and the led anode ?
            is the resistor an appropriate value ?
            is the chip powered correctly ?
            is the chip actually being programed ? and verified ?
            have you tried another pin ? another chip ? (have youmay have damaged it ... esd etc. )










            Still not working

            does the led work ? = Yes
            is it orientated correctly ? ie cathode to ground = I tested both directions.
            do you have a resistor between pin6 and the led anode ? = Yes 480 R
            is the resistor an appropriate value ? Use them all the time =480 R
            is the chip powered correctly ? = pin 5 VSS - / pin 14 Vdd +
            is the chip actually being programed (software tells me programed and verified )
            have you tried another pin = YES same code only pin5 ,another chip ?= Yes and I Programmed in circuit and with adapter (3Three setups ) meLab Ziff see attached pics
            Changed resistor to 10 K
            I need define OSC 4 and OSCCON = $60 ?
            Yes I changed code to start with a simple version and hopped I build from there to find my mistakes .

            Comment


            • #7
              Originally posted by DavidP View Post
              I did notice you have changed the oscillator to internal. If this is the actual code, You still need to set the oscillator define for the PBP compiler to synchronize the code timing's to. I would also change the pullup resistor on the RESET line to 10K as the lower value may not allow the proper reset timing required.








              Still not working

              does the led work ? = Yes
              is it orientated correctly ? ie cathode to ground = I tested both directions.
              do you have a resistor between pin6 and the led anode ? = Yes 480 R
              is the resistor an appropriate value ? Use them all the time =480 R
              is the chip powered correctly ? = pin 5 VSS - / pin 14 Vdd +
              is the chip actually being programed (software tells me programed and verified )
              have you tried another pin = YES same code only pin5 ,another chip ?= Yes and I Programmed in circuit and with adapter (3Three setups ) meLab Ziff see attached pics
              Changed resistor to 10 K
              I need define OSC 4 and OSCCON = $60 ?
              Yes I changed code to start with a simple version and hopped I build from there to find my mistakes .


              Comment


              • #8
                Still not working

                does the led work ? = Yes
                is it orientated correctly ? ie cathode to ground = I tested both directions.
                do you have a resistor between pin6 and the led anode ? = Yes 480 R
                is the resistor an appropriate value ? Use them all the time =480 R
                is the chip powered correctly ? = pin 5 VSS - / pin 14 Vdd +
                is the chip actually being programed (software tells me programed and verified )
                have you tried another pin = YES same code only pin5 ,another chip ?= Yes and I Programmed in circuit and with adapter (3Three setups ) meLab Ziff see attached pics
                Changed resistor to 10 K
                I need define OSC 4 and OSCCON = $60 ?
                Yes I changed code to start with a simple version and hopped I build from there to find my mistakes .

                '---------------Title--------------

                ' File......blink1.pbp
                ' Started....11/3/03
                ' Microcontroller used: Microchip Technology 16F88
                ' microchip.com
                ' PicBasic Pro Code: micro-Engineering Labs, Inc.
                ' melabs.com

                '--------Program Desciption--------

                ' LED flashes one time per second.

                '----------Related Lesson----------

                ' blink1.pbp is used in the lesson INTRODUCTION TO PROGRAMMING 1 at:
                ' http://www.cornerstonerobotics.org/c...ogramming1.pdf

                '-------------Comments-------------

                ' Use a solderless breadboards to fabricate
                ' the circuit blink1. For a tutorial about
                ' solderless breadboards, consult the book Robot
                ' Building For Beginners by David Cook. Also see:
                ' http://cornerstonerobotics.org/curri...Breadboard.pdf
                '
                ' In-Circuit Serial Programming(ICSP): See:
                ' http://cornerstonerobotics.org/curri...rogramming.pdf

                '----------PIC Connections---------

                ' 16F88 Pin Wiring
                ' --------- ----------
                ' RB0 150 Ohm resistor to LED to GND
                ' Vdd +5 V
                ' Vss Ground
                ' MCLR 4.7K Resistor to +5 V

                '-----New PicBasic Pro Commands----

                ' The source for PicBasic Pro commands is
                ' from the PicBasic Pro Compiler Manual by
                ' microEngineering Labs, Inc.
                ' The PicBasic Pro Compiler Manual is on line at:
                ' http://www.microengineeringlabs.com/...ex.htm#Manuals
                '
                ' PAUSE period
                ' This will pause the program for a period of 1
                ' to 65,535 milliseconds or .001 to 65.535 sec.
                ' Around page 112 in the PicBasic Pro Compiler Manual
                '
                ' GOTO label
                ' Program execution jumps to location of label.
                ' Around page 73 in the PicBasic Pro Compiler Manual
                '
                ' END
                ' Stops the program execution.
                ' Around page 68 in the PicBasic Pro Compiler Manual

                '---------Revision History---------

                ' 5/24/08 Convert from PIC16F84A to PIC16F88
                ' and add 16F88 oscillator initialization

                '-----------Initialization---------

                ;----[16F88 Hardware Configuration]---------------------------------------------
                #IF __PROCESSOR__ = "16F88"
                #DEFINE MCU_FOUND 1
                #CONFIG
                cfg1 = _INTRC_IO ; INTRC oscillator; port I/O function on both RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin
                cfg1&= _WDT_ON ; WDT enabled
                cfg1&= _PWRTE_OFF ; PWRT disabled
                cfg1&= _MCLR_ON ; RA5/MCLR/VPP pin function is MCLR
                cfg1&= _BODEN_ON ; BOR enabled
                cfg1&= _LVP_OFF ; RB3 is digital I/O, HV on MCLR must be used for programming
                cfg1&= _CPD_OFF ; Code protection off
                cfg1&= _WRT_PROTECT_OFF ; Write protection off
                cfg1&= _DEBUG_OFF ; In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins
                cfg1&= _CCP1_RB0 ; CCP1 function on RB0
                cfg1&= _CP_OFF ; Code protection off
                __CONFIG _CONFIG1, cfg1

                cfg2 = _FCMEN_ON ; Fail-Safe Clock Monitor enabled
                cfg2&= _IESO_ON ; Internal External Switchover mode enabled
                __CONFIG _CONFIG2, cfg2

                #ENDCONFIG

                #ENDIF

                ;----[Verify Configs have been specified for Selected Processor]----------------
                ; Note: Only include this routine once, after all #CONFIG blocks
                #IFNDEF MCU_FOUND
                #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
                #ENDIF


                TRISB = %11111110 ' Sets up RB0 pin of PORTB as an output
                ' and pins RB7-RB1 of PORTB as inputs

                OSCCON = $60 ' Sets the internal oscillator in the
                ' 16F88 to 4 MHz

                '-------------Main Code------------

                start: ' Label for beginning loop

                'PORTB.0 = 1 ' Makes pin PORTB.0,(RB0), output at HIGH (+5 volts)
                PORTB.5 = 1
                Pause 500 ' Pause 500 milliseconds (0.5 seconds) with LED on

                'PORTB.0 = 0 ' Makes pin PORTB.0,(RB0), output at LOW (0 volts)
                PORTB.5 = 0
                Pause 500 ' Pause 500 milliseconds (0.5 seconds) with LED off

                GoTo start ' Jump to loop label
                ' Makes the program run forever.

                End ' This line is in case the
                ' the program gets lost.

                Comment


                • #9
                  your comments say

                  ' 16F88 Pin Wiring
                  ' --------- ----------
                  ' RB0 150 Ohm resistor to LED to GND
                  ' Vdd +5 V
                  ' Vss Ground
                  ' MCLR 4.7K Resistor to +5 V
                  are you sure about the led series resistor 480 ohms is an unlikely value 470 would be the e24 standard value , 10k would not work at all. suitable range is 150 to 560 ohms

                  MCLR 4.7K Resistor to +5 V is this present ?

                  I will repeat there is nothing wrong with the code the problem lies elsewhere

                  although its good practice to to define the OSC value, its unnecessary if your OSC speed is 4 MHz

                  this line could be inserted if one chose to ( note OSC is case sensitive)
                  define OSC 4




                  have you tried another pin = YES same code only pin5 ,another chip ?= Yes and I Programmed in circuit and with adapter

                  YES same code only pin5

                  really ............... pin 5 is vss

                  YES same code only pin5

                  really ............... same code

                  Comment


                  • #10
                    Sorry PORTB.5=0 and PORTB.5=1

                    Comment

                    Working...
                    X