Reading Device ID from within PBP


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default Reading Device ID from within PBP

    I need to determine the chip type I'm running in, as well as the oscillator configuration. I seem to vaguely remember a thread on reading the configuration bytes and the Device ID from within PBP, but a search turns up nothing. Could someone please tell me where to look?
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    mmm, i think some part of it are available... but for 18Fs

    i think you refer to the following...
    http://www.picbasic.co.uk/forum/showthread.php?t=4093
    Last edited by mister_e; - 24th February 2007 at 17:45.
    Steve

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

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Thanks. That is what I was looking for. I only work with 18F parts, so this should do it.

    Thanks to you (and Darrel)

    Charles Linquist
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    I just opened the 18F4550.inc file...look what you got at the end of...
    Code:
    _DEVID1          EQU  H'3FFFFE'
    _DEVID2          EQU  H'3FFFFF'
    
    _IDLOC0          EQU  H'200000'
    _IDLOC1          EQU  H'200001'
    _IDLOC2          EQU  H'200002'
    _IDLOC3          EQU  H'200003'
    _IDLOC4          EQU  H'200004'
    _IDLOC5          EQU  H'200005'
    _IDLOC6          EQU  H'200006'
    _IDLOC7          EQU  H'200007'
    Sure there's something to do with it...
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    yes indeed that was simple to read the PIC ID using one part of the Darrel's code and a 18F4680
    Code:
        '   READING pic18f4680 DEVICE ID
        '
        DEFINE OSC 20
        DEFINE LOADER_USED 1
        DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
        DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
        DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
        DEFINE HSER_CLROERR 1 ' Clear overflow automatically
        ID1 var byte
        ID2 var byte
        GOTO START
    
    @  #include "RTconfig.inc"
    
    START:  
        @ ReadConfig?CB _DEVID1, _ID1
        @ ReadConfig?CB _DEVID2, _ID2
        HSEROUT ["DEVID1=",HEX ID1,"    DEVID2=",HEX ID2]
        STOP
    Serial communicator show...
    Code:
    DEVID1=82    DEVID2=0E
    Using a my programmer to read the device, i have...
    Code:
    L0100: >> 24.02.2007, 13:10:13
    L0101: Reading device: Microchip PIC18F4680.
    L0102: Device insertion test ...
    L0103: Checking device ID ...
    L0104: Device ID: DEVID2=0Eh  DEVID1=82h
    L0105: Reading device ...
    L0106: Verifying device at VCCmax. ...
    L0107: Verifying device at VCCmin. ...
    L0108: Reading device - done.
    L0109: Elapsed time: 0:00:30.6
    L0110: Buffer checksum in range of device [0h..7FFFh]: 00FD3D23h
    Somehow interesting. i bet you will be able to change and create your own device ID in the ID locations at run time as well. Nice place to save the software version...
    Last edited by mister_e; - 24th February 2007 at 18:26.
    Steve

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

  6. #6


    Did you find this post helpful? Yes | No

    Red face oh you can change it alright

    Along with erasing osccal values, some of the free software or maybe a glitch has managed to erase the device id as well. i have a few pics that show up as unknown. I'm quickly becoming an expert on what NOT to do. lol.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. Watchdog Timers
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th August 2014, 18:03
  3. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  4. Replies: 2
    Last Post: - 8th February 2009, 05:10
  5. @ Device Parameters
    By Randy_Suwanee in forum General
    Replies: 2
    Last Post: - 11th August 2004, 14:40

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