reading I/O state of pic12f675...


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    thanks Henrik,
    I received your msg 7 just now. Now it is very clear to me ,.

    In my previous msg I refer to register 05h.
    rgds,
    Ambro

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    I wouldn't call the GPIO registers a "setting" (though it's really no different than any other register). It is the port register which is connected to the actual I/O pins.

    Write to GPIO and the bits will appear on the port pins configured as outputs. Read from GPIO and you'll get the state of the register. The state of each individual bit will properly reflect the state logic state of the actual pin provided that the pin IS set to digital, it IS set to input and the voltage is either less than VIL (for a logic zero) or more than VIH (for a logic one).

    In other words, if the voltage on GPIO.0 is less than VIL myVAR = GPIO.0 will be 0 and if the voltage is higher than VIH myVAR = GPIO.0 will be 1. If the voltage is somewhere in between VIL and VIH the result is unspecified.

    Your original problem was that the pin was not set to digital and as the datasheet says: I/O pins configured as analog inputs always read ‘0’.

    /Henrik.

  3. #3
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    Hi,
    it is working for the first time. If I do reprogram the chip then I have the following message:


    017-05-09 12:13:19 +0200 - Programming...
    Target has invalid calibration data (0x00).

    Device Erased...

    Programming...

    The following memory area(s) will be programmed:
    program memory: start address = 0x0, end address = 0x45
    configuration memory
    program memory
    Address: 0 Expected Value: 2828 Received Value: 0
    Failed to program device
    2017-05-09 12:13:23 +0200 - Programming failed
    Pass Count: 49

    It is the first time I face with a so small PIC devices... Is it critical ?
    thanks
    Ambro

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    Not sure but I believe it might have something to do with the calibration value for the internal oscillator. I see you're manually setting OSCCAL to 64 at the top of the program but I'm wondering if what the error message is trying to say is that you've erased the factory calibration value originally stored in the PIC. Does the program work at all?

    If you want PBP to use the default calibration value add DEFINE OSCCAL_1K 1 but it will obviously not work on a device where you've erased the calibration value.

  5. #5
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    yes, the program that I loaded before still runs.
    No other code can be loaded .
    I changed the micro : all OK at first programming. The same message comes out at the second programming.
    regards,
    Thanks
    Ambro

  6. #6
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    Hi to all,
    I still have this message from PICKIT_3:

    Target Detected

    Programming...
    The following memory regions failed to program correctly:
    Program Memory
    Address: 00000000 Expected Value: 00002842 Received Value: 00000000
    Programming failed

    Any advice please ?
    Thanks in advance
    Ambrogio

  7. #7
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    I forgot to tell that the PICKIT_3 works well when programming the pic18F252.

    >> it seems to me that the PICKIT_ 3 is loading the BOOTloader when the device is changed from PIC18 to PIC12F675...
    How to inhibit it ?
    Thanks
    Ambrogio

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: reading I/O state of pic12f675...

    it seems to me that the PICKIT_ 3 is loading the BOOTloader when the device is changed from PIC18 to PIC12F675...
    How to inhibit it ?
    You can't. Different device families needs different things from the PICKit3 and it doesn't have enough memory on board to remember it all. So when you switch families (or switch software from which you "run" the PICKit3) it needs to have a different fimrware image loaded.

    There's an issue with using the internal oscillator AND GP3 as IO at the same time. The issue is that as soon as power is applied the internal oscillator starts and sets the IO pins up which now prevents the PK3 from "accessing" it in order to enter programming mode. IF you're supplying power to the device externally then try disconnecting that and power the device directly from the PICKit3, if you're running the standalone application for the PICKit3 look for the Vpp before Vdd setting and enable that (if there is one, I don't remember).

    If you spend 5 minutes with Google you'll find threads on several forums (including this one) which discusses the issue. For example, here's one

Similar Threads

  1. Knowledge of State Variable Filters
    By Lucy248 in forum General
    Replies: 1
    Last Post: - 9th September 2016, 08:56
  2. Changing output state after 2 minutes
    By carljbrooks in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st February 2014, 05:28
  3. DC - AC Solid State Relay
    By shahidali55 in forum General
    Replies: 6
    Last Post: - 10th November 2007, 16:01
  4. State machine programming
    By tjstevens in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th April 2007, 22:45
  5. Replies: 2
    Last Post: - 27th March 2007, 12:48

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