Problem setting pins on 12f675


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Default Problem setting pins on 12f675

    I have been trying some simple programs to test the PICkit 2 logic probe.

    The following code should set gpio.0 to 1 (this is used as a trigger pulse for the PICkit2). The gpio.0 pulse is 1ms wide, it waits 5ms then sets gpio.1 high, waits 5ms, sets gpio.2 high, waits 5ms and then clears all pins and loops.

    It does not work as expected.

    The 1ms pulse on gpio.0 is OK, and gpio.1 goes high and stays there for 5ms.

    BUT .... when gpio.2 is set to 1, gpio.1 is cleared to 0 at the same time, I expected it to stay high.

    Swaping the sequence of gpio.1 and gpio.2 shows the same effect, seting one of the gpio.1 or gpio.2 to 1 clears the other one to 0.

    Is there a problem in PICBASIC setting pins on a 12f675 individually ?

    I tried the code on the 16f887 demo board that comes with the PICkit2 and it works just fine.



    ANSEL = 0

    loop:
    output gpio.0
    output gpio.1
    output gpio.2
    high gpio.0 'send high for trigger
    pause 1 '1ms wide pulse
    low gpio.0 'send it low
    pause 5 'wait 5ms
    high gpio.1 'send gpio.1 high
    pause 5 'wait 5ms
    high gpio.2 'send gpio.2 high
    pause 5 'wait 5ms
    low gpio.1 ' set low
    low gpio.2 ' set low
    pause 20 'wait 20ms with all pins low
    Goto loop 'Go back to loop and do pulses forever

    End

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


    Did you find this post helpful? Yes | No

    Default

    how about CMCON register?
    Steve

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

  3. #3
    Join Date
    Feb 2009
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Ah CMCON

    You were right.

    Guess I was guilty of assuming that when the manual says a pin will automatically be made an input (or output) it does not mean the pin will be a fully functional input ........

Similar Threads

  1. Configuration bits setting problem
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th August 2009, 17:25
  2. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  3. strange problem 12f675
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th July 2007, 13:47
  4. 12f675 Serout Int_Osc problem
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th April 2007, 09:39
  5. Setting OSC pins to o/p's
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th October 2005, 21:34

Members who have read this thread : 0

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