Announcement

Collapse
No announcement yet.

Me-prog U2 - Serial number options

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Me-prog U2 - Serial number options

    Hi am Unsure of how to use this option

    the serial number option to add bytes to a starting address xx ,

    is the address in program data area or the eeprom area of the PIC,

    regards

  • #2
    The starting address is the physical hardware address anywhere in the chip.

    Addresses starting at 0000 are in program space.

    On the 16F1 enhanced core devices, EEPROM starts at F000 and the ID locations are 8000-8003.

    There is a table of addresses for the different families in the help file for the meProg software.
    It's in the "View Menu | Serial Number" section.
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment


    • #3
      thanks darrel ,

      if the serial number of 4 bytes are written to user id area 8000h -8003h at program time hows is this number read back using pic basic with the program .

      is it " readcode 8000 , w" ' reads bytes at address 8000 & 8001 , into var w ???

      Also is there a option for melabs programer software to store the current value of the serial number so that the number is preloaded so i know what the batch range s/n , so is never used again until reset

      Comment


      • #4
        Originally posted by longpole001 View Post
        Also is there a option for melabs programer software to store the current value of the serial number so that the number is preloaded so i know what the batch range s/n , so is never used again until reset
        i think it does now , still playing with little guy , cheers

        Comment


        • #5
          still having a problem reading the serial number back into PBP - also found this code is corrupting the value at EEprom location 1

          When reading the prom 16f1825 - user id value is correct with the correct value of
          0000 0001 xxxx xxxx


          background :
          Enable serial number in melabs u2 - setting are
          ser no = 1
          inc by 1
          start add = 8000
          No location = 2
          msb first ticked


          what am i missing

          Cheers

          Sheldon
          Code:
              readcode  $8000 ,Lmp_Serial_wrd1    ' Read word at location $8000  - User ID Word1 - Upper word stored serial number from melabs U2 PIC pregrammer
              readcode  $8001 ,Lmp_Serial_wrd2    ' Read word at location $8001  - User ID Word2 - Lower word Stored serial number from melabs U2 PIC pregrammer
             write $0A,Lmp_Serial_wrd1.highbyte    ' put in  eeprom for test
             write $0B,Lmp_Serial_wrd1.lowbyte     ' put in eeprom for test
             write $0C,Lmp_Serial_wrd2.highbyte    ' put in  eeprom for test
             write $0D,Lmp_Serial_wrd2.lowbyte     ' put in eeprom for test

          Comment


          • #6
            Sheldon,

            READCODE can't read the ID locations since they are considered part of the Configuration space.
            It can only read actual Program space.

            To read the Configuration space, the EECON1,CFGS bit has to be set.

            The Serial Number function puts 1 BYTE into each ID location.
            With the 4 locations, you can store a 32-bit serial number.

            Here's a simple routine that reads the ID's into a 4-byte array.
            Code:
            EE_ADR  VAR WORD EXT : @EE_ADR = EEADRL
            UserID  VAR BYTE[4]
            
            FOR EE_ADR = $8000 TO $8003
                EECON1.6 = 1   ; CFGS
                EECON1.0 = 1   ; RD
                @ NOP
                @ NOP    
                UserID(EE_ADR - $8000) = EEDATL
            NEXT EE_ADR
            Then you can write it to EEPROM if you want for your testing purposes ...
            Code:
            WRITE $0A, UserID(0)
            WRITE $0B, UserID(1)
            WRITE $0C, UserID(2)
            WRITE $0D, UserID(3)
            Change the "Number of Locations" to 4 in the Serial Number dialog.
            PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
            Never download a PIC datasheet from anywhere but microchip.com

            Comment


            • #7
              thanks darrel , i not seen or used this type of code where tring to reading config space

              also the " VAR WORD EXT: " is new define type that I not seen before in the help

              cheers

              Comment


              • #8
                I've explained the EXT modifier here.
                http://www.picbasic.co.uk/forum/showthread.php?t=3891
                PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
                Never download a PIC datasheet from anywhere but microchip.com

                Comment


                • #9
                  very interesting reading , i think i could get some interesting results if done badly

                  why the "@ Nop" in your example , is there a timming issue when reading / writing the values ?


                  cheers

                  Sheldon

                  Comment


                  • #10
                    i think i could get some interesting results if done badly
                    It's more interesting if you do it the right way.

                    why the "@ Nop" in your example
                    A read from Flash memory requires NOP's after the RD bit is set because the processor uses the next instruction cycle to perform the actual Read.
                    The second NOP is ignored for reasons in Note 1 below from the 16F1825 datasheet.

                    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
                    Never download a PIC datasheet from anywhere but microchip.com

                    Comment


                    • #11
                      again thanks Darrel , your Input is excellent and it is most appreciated

                      i will be learning more and use of the EXT as it offers a lot of things , more so in making better use of word space on PIC , the current project has grown and continues to do so , already got past 6000 words , and will have to look at how i am doing things at this rate.

                      I dont wont to change pics again to go to higher than 8k words PIC , may look at how to use 2 x 16F1825 on one board , again that would be a new area - any links on how 2 combine 2 PICS will look at this aspect next month as it would offer this project some options i am not able to do easy atm.

                      Another area that is coming up is how to program these chips via ICSP header from the melab programmer ,at about 10 - 20 units PICS at a time , even for the code testing phase it will be handy.

                      any timing issues / recommend chip types for the CMOS ( cos of Vpp at 9v) for I/O buffers on the PGD, PGC and an Output buffer on VPP,

                      figure the standard TTL fanout rate of 6 devices per I/O set ?

                      cheers

                      Sheldon

                      Comment


                      • #12
                        While it is possible to program several devices at the same time from an melabs programmer ... it's not possible to determine if an error occured during the process.

                        Tracking down problems related to unreported programming errors can give you ulcers.

                        So you should purchase a very expensive "Gang Programmer", or have Microchip program them for you at about 20 cents each.
                        PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
                        Never download a PIC datasheet from anywhere but microchip.com

                        Comment


                        • #13
                          its seems a gang option could be made for the U2 if it was supported by the software , for the both the serial number programming and the program / verify, using the existing 10pin header ( not sure if the 3 pins marked as reserved , may be used for this option )

                          Selection of verify for lower/ upper VDD range as well.

                          wishfull thinking i guess

                          Comment

                          Working...
                          X