pic 16f688


Closed Thread
Results 1 to 14 of 14

Thread: pic 16f688

  1. #1
    Join Date
    Aug 2014
    Location
    CHICAGO
    Posts
    9

    Unhappy pic 16f688

    Hello every body: I just joint the forum. Switching now slowly over from Basic Stamp 2 to the pick micro. I have Basic pro Gold . I have programmed some 12f683 successful. However I started now with the pic 16f688 because I needed more I/O. And it has the same programming pin configuration then the 12f683 which fits my Omega prototyping board. My Problem is: Con fig file. Or addressing the pins correctly. Or both. Especial I don’t know if using eight. $00000000 is OK because it is not working. I understand port A and port B have only 6 Ports. This is my code: #CONFIG ifdef PM_USED device pic16F688, intrc_osc_noclkout, wdt_on, mclr_on, protect_off else __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF endif #ENDCONFIG ansel=0 'set i/o to digital cmcon0 = 7 'comparator off TRISC=%000001 ' set PortC RC5-RC1 to ‘outputs, RC0 input PORTC=%000010 ' Set PortC RC1 high to turn ‘on LED1 Main: ' *** Test the switch state *** if portC.0 = 0 then led2 'If switch is pressed then ‘jump to LED2 routine PortC.1 = 1 ' Turn LED1 on portC.2 = 0 ' Turn LED2 off goto Main ' Jump to the top of the main loop LED2: '*** Turn LED2 on *** portC.2 = 1 ' LED2 on portC.1 = 0 ' LED1 off goto Main ' Jump to the top of the main

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    Quote Originally Posted by MERLIM View Post
    Hello every body: I just joint the forum. Switching now slowly over from Basic Stamp 2 to the pick micro. I have Basic pro Gold . I have programmed some 12f683 successful. However I started now with the pic 16f688 because I needed more I/O. And it has the same programming pin configuration then the 12f683 which fits my Omega prototyping board. My Problem is: Con fig file. Or addressing the pins correctly. Or both. Especial I don’t know if using eight. $00000000 is OK because it is not working. I understand port A and port B have only 6 Ports. This is my code:
    Code:
    #CONFIG     ifdef PM_USED         device  pic16F688, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
         else         __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
         endif
     #ENDCONFIG
     ansel=0      'set i/o to digital
     cmcon0 = 7   'comparator off 
     TRISC=%000001 ' set PortC RC5-RC1 to ‘outputs, RC0 input
     PORTC=%000010 ' Set PortC RC1 high to turn ‘on LED1
    
      Main:                 ' *** Test the switch state ***
      if portC.0 = 0 then led2     'If switch is pressed then  ‘jump to LED2 routine
      PortC.1 = 1                   ' Turn LED1 on
      portC.2 = 0                   ' Turn LED2 off
      goto Main                     ' Jump to the top of the main loop 
      LED2:                '*** Turn LED2 on ***
      portC.2 = 1                   ' LED2 on
      portC.1 = 0                   ' LED1 off
      goto Main                     ' Jump to the top of the main
    This the way to display you code

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    Start by adding a PAUSE 500 after you turn the LEDs on and off.

    Your LED is probably blinking faster than your eye can detect (or not leaving enough time for the LED to emit light).

    Robert

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    Symbols in PBP have meaning that may be different than other languages, I. E. "C" .
    % is used for binary, example %11111111 it does NOT use 0b00000000 or $00000000 as binary
    $ is used for HEX , example $FF

    This response is to your thread http://www.picbasic.co.uk/forum/showthread.php?t=19419
    Last edited by Archangel; - 31st August 2014 at 00:26.
    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.

  5. #5
    Join Date
    Apr 2012
    Location
    Ptolemaida
    Posts
    50


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    If you don't want your pick to reset turn off the watchdog timer from configuration bits

    Code:
    __config_ wdt off
    One man's magic is ANOTHER man's engineering.
    Supernatural is a null word

  6. #6
    Join Date
    Apr 2012
    Location
    Ptolemaida
    Posts
    50


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    If you don't want your pic to reset turn off the watchdog timer from configuration bits

    Code:
    __config_ wdt off
    One man's magic is ANOTHER man's engineering.
    Supernatural is a null word

  7. #7
    Join Date
    Aug 2014
    Location
    CHICAGO
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    Thank you .

    Sorry, I was not working for a long time and newer answered.

  8. #8
    Join Date
    Aug 2014
    Location
    CHICAGO
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    I Wiil TRY Thankyou

  9. #9
    Join Date
    Aug 2014
    Location
    CHICAGO
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    I changed the programm!
    It compiles fine my
    U2 programmer is working.

    It compiles and programms fine in Micro Code Studio Plus
    however no red light is flashing on the U2 programmer .

    PS: my U2 programmer is working.

    When I check the HEX. File in meProg.
    red light is flashing on the U2 programmer
    After programming the HEX. File looks different !



    '************************************************* ***************
    '* Name : TEST_0_16F88_config_3 *
    '* Author : [WVA] *
    '* Notice : Copyright (WVA) 2014 *
    '* : All Rights Reserved *
    '* Date : May/ 2015 *
    '* Version : 1.0 *
    '* Notes : INITIAL_SETUP_16F88 *
    '* : *
    '************************************************* ***************
    ;----[16F88 Hardware Configuration]---------------------------------------------



    #IF __PROCESSOR__ = "16F88"

    #DEFINE MCU_FOUND 1

    #CONFIG

    cfg1 = _INTRC_IO ; INTRC oscillator; CLKO function on RA6/OSC2/CLKO pin and port I/O function on RA7/OSC1/CLKI pin
    cfg1&= _WDT_OFF ; 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


    #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


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

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

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


  10. #10
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    compiles and programms fine in Micro Code Studio Plus
    however no red light is flashing on the U2 programmer .
    How is the programmer connected?

    Robert
    Last edited by Demon; - 13th June 2015 at 13:01.

  11. #11
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    To avoid problems in the future:

    http://www.picbasic.co.uk/forum/show...556#post127556

    Also, use uppercase for DEFINEs.

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    Your config looks wonky.

    __CONFIG _CONFIG1, cfg1

    This looks like left-over from a copy&paste.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  13. #13
    Join Date
    Aug 2014
    Location
    CHICAGO
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    Thanks, i dd

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: pic 16f688

    if you load your (programmed as discussed) 16f88 into the u2 then use the "read" icon do you get results as per this attachment ?
    can you erase a chip ?
    can you verify a blank chip ?
    can you reprogram chip and then verify it ?
    Attached Images Attached Images  

Similar Threads

  1. 16f688 interrupt
    By RHS_electronics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th March 2009, 19:27
  2. PC to EUART on pic 16F688
    By docaberle in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 25th October 2008, 07:33
  3. 16f688 Adc
    By PICante in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd August 2008, 11:34
  4. 16f688 <-> Max232
    By PlantBob in forum Serial
    Replies: 1
    Last Post: - 25th March 2008, 15:57
  5. Help with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st October 2006, 00:12

Members who have read this thread : 2

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