PIC16F88 problem with TOGGLE command?


Closed Thread
Results 1 to 3 of 3
  1. #1
    russman613's Avatar
    russman613 Guest

    Default PIC16F88 problem with TOGGLE command?

    I am using a very slighly modified version of the blink sample program:

    @ DEVICE PIC16F88, HS_OSC
    define OSC 20
    pinLED var portb.7

    loop:
    high pinLED ' Turn on LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds
    low pinLED
    pause 500

    Goto loop ' Go back to loop and blink LED forever

    End

    I am using the following software:
    ~~~~~~~~~~~~~~~~~~~~~~
    - MicroCode Studio version 2.3.0.0
    - melabs Programmer Version 4.01
    - PicBasic Pro version version 2.46 (with the lastest patch installed even though
    it does not show the version on the command line.

    For hardware, I am using:
    ~~~~~~~~~~~~~~~~~
    - PIC16F88
    - 20 Mhz Resonator
    - PICPROTO18L board
    - melabs USB Programmer

    The Problem:
    ~~~~~~~~~

    When i modify the program as follows:

    @ DEVICE PIC16F88, HS_OSC
    define OSC 20
    pinLED var portb.7

    loop:
    toggle pinLED
    'high pinLED ' Turn on LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds
    'low pinLED
    'pause 500

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

    the LED does not blink. The strange thing is, when I put the LED on portb.0 through portb.5 it works just fine. For all porta and portb.6, portb.7 the toggle command does not function.

    What am I missing or is there a known issue?

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by russman613
    The Problem:
    ~~~~~~~~~

    the LED does not blink. The strange thing is, when I put the LED on portb.0 through portb.5 it works just fine. For all porta and portb.6, portb.7 the toggle command does not function.

    What am I missing or is there a known issue?
    Try adding the line ANSEL=0

    The pins that "dont work" are analogue by default.

    "Toggle" reads the port data register, modifies the appropriate bit and writes it back to the data register. Because they are analogue inputs they read as "0" so toggle will always set it to a "1" but you wont read that value back.

    Had me stumped the first time I came across it
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #3
    russman613's Avatar
    russman613 Guest


    Did you find this post helpful? Yes | No

    Default PIC16F88 problem with TOGGLE command?

    Keith - you are a rock star.

    that did it for me - guess i still have some data sheet reading to do ...

    thx for the TOGGLE russFrustration.

    Russ

Similar Threads

  1. Toggle command
    By mr.sneezy in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 16th December 2011, 02:07
  2. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  3. toggle command w/ multiple switches
    By earltyso in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th February 2007, 17:47
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57
  5. New user with PAUSE command problem
    By Howy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 6th August 2004, 01:54

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