Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 11:03:44 23:03


Login with username, password and session length


Pages: [1]
Print
Author Topic: CCS Info - Global variable that change every time PIC programmed  (Read 4667 times)
0 Members and 1 Guest are viewing this topic.
M@X77
Junior Member
**
Offline Offline

Posts: 54

Thank You
-Given: 46
-Receive: 6


« on: October 25, 2019, 12:33:06 12:33 »

I looking for to implement a global variable that change every time PIC programmed, I would like to use it to change MAC address every time I program a device.
I evaluated global IDE variable as similar to __DATE__ or __TIME__ implemented into compiler but seems it no works well, I would like to shure that MAC is univoke.

Thanks
Max
Logged
microstick
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 107
-Receive: 10


« Reply #1 on: October 25, 2019, 01:22:33 13:22 »

Hi,
Use #serialize
Logged
gurksallad
Newbie
*
Offline Offline

Posts: 27

Thank You
-Given: 12
-Receive: 6


« Reply #2 on: October 26, 2019, 02:55:08 02:55 »

#serialize was a feature used back in Hitech C-compilers. Are you sure it's still used in today's XC compilers? I cannot find any reference for it.
Logged
PICker
Active Member
***
Offline Offline

Posts: 162

Thank You
-Given: 207
-Receive: 109


« Reply #3 on: October 26, 2019, 08:48:34 08:48 »

Hi Max
can you specify a little bit more about you need?
Do you change the MAC address in the source code before reprogram the device or you want a kind of automatic change of the MAC address?
In the first case, you can use a variable, the EEprom memory or the flash memory to write the new address.
You can use also a function that returns the MAC address.
In the second case, I don't think that CCS can insert this value for you in the source code.
If you want a sort of automatism you can use, for example. AutoIt to change the MAC address in your source code Before every reprogram.
Is it possible that I did not well understand your need, sorry for my suggestions in this case.

Logged
microstick
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 107
-Receive: 10


« Reply #4 on: October 26, 2019, 09:50:54 09:50 »

Hi is talking about ccsinfo compiler

see below about #serialize

#serialize
Syntax:
#SERIALIZE(id=xxx, next="x" | file="filename.txt" " | listfile="filename.txt",
"prompt="text", log="filename.txt") -
#SERIALIZE(dataee=x, binary=x, next="x" | file="filename.txt" |
listfile="filename.txt",
prompt="text", log="filename.txt")

Elements:
id=xxx - Specify a C CONST identifier, may be int8, int16, int32 or char array.
Use in place of id parameter, when storing serial number to EEPROM:
dataee=x - The address x is the start address in the data EEPROM.
binary=x - The integer x is the number of bytes to be written to address specified.
string=x - The integer x is the number of bytes to be written to address specified.
unicode=n - If n is a 0, the string format is normal unicode. For n>0 n indicates the
string
number in a USB descriptor.
Use only one of the next three options:
file="filename.txt" - The file x is used to read the initial serial number from, and this file
is updated by the ICD programmer. It is assumed this is a one line file with the
serial number. The programmer will increment the serial number.
listfile="filename.txt" - The file x is used to read the initial serial number from, and this
file is updated by the ICD programmer. It is assumed this is a file one serial
number per line. The programmer will read the first line then delete that line from
the file.
next="x" - The serial number X is used for the first load, then the hex file is updated to
increment x by one.

Other optional parameters:
prompt="text" - If specified the user will be prompted for a serial number on each load.
If used with one of the above three options then the default value the user may
use is picked according to the above rules.
log=xxx - A file may optionally be specified to keep a log of the date, time, hex file name
and serial number each time the part is programmed. If no id=xxx is specified
then this may be used as a simple log of all loads of the hex file.
Description:
Assists in making serial numbers easier to implement when working with CCS ICD units.
Comments are inserted into the hex file that the ICD software interprets.

Examples:
//Prompt user for serial number to be placed
//at address of serialNumA
//Default serial number = 200int8int8 const serialNumA=100;
//#serialize(id=serialNumA,next="200",prompt="Enter the serial number")
//Adds serial number log in seriallog.txt
//#serialize(id=serialNumA,next="200",prompt="Enter the serial number",


REMARK: It is working with their programmer
Logged
M@X77
Junior Member
**
Offline Offline

Posts: 54

Thank You
-Given: 46
-Receive: 6


« Reply #5 on: October 26, 2019, 09:07:00 21:07 »

Hi is talking about ccsinfo compiler

see below about #serialize

#serialize
Syntax:
#SERIALIZE(id=xxx, next="x" | file="filename.txt" " | listfile="filename.txt",
"prompt="text", log="filename.txt") -
#SERIALIZE(dataee=x, binary=x, next="x" | file="filename.txt" |
listfile="filename.txt",
prompt="text", log="filename.txt")

Elements:
id=xxx - Specify a C CONST identifier, may be int8, int16, int32 or char array.
Use in place of id parameter, when storing serial number to EEPROM:
dataee=x - The address x is the start address in the data EEPROM.
binary=x - The integer x is the number of bytes to be written to address specified.
string=x - The integer x is the number of bytes to be written to address specified.
unicode=n - If n is a 0, the string format is normal unicode. For n>0 n indicates the
string
number in a USB descriptor.
Use only one of the next three options:
file="filename.txt" - The file x is used to read the initial serial number from, and this file
is updated by the ICD programmer. It is assumed this is a one line file with the
serial number. The programmer will increment the serial number.
listfile="filename.txt" - The file x is used to read the initial serial number from, and this
file is updated by the ICD programmer. It is assumed this is a file one serial
number per line. The programmer will read the first line then delete that line from
the file.
next="x" - The serial number X is used for the first load, then the hex file is updated to
increment x by one.

Other optional parameters:
prompt="text" - If specified the user will be prompted for a serial number on each load.
If used with one of the above three options then the default value the user may
use is picked according to the above rules.
log=xxx - A file may optionally be specified to keep a log of the date, time, hex file name
and serial number each time the part is programmed. If no id=xxx is specified
then this may be used as a simple log of all loads of the hex file.
Description:
Assists in making serial numbers easier to implement when working with CCS ICD units.
Comments are inserted into the hex file that the ICD software interprets.

Examples:
//Prompt user for serial number to be placed
//at address of serialNumA
//Default serial number = 200int8int8 const serialNumA=100;
//#serialize(id=serialNumA,next="200",prompt="Enter the serial number")
//Adds serial number log in seriallog.txt
//#serialize(id=serialNumA,next="200",prompt="Enter the serial number",


REMARK: It is working with their programmer


Hanks microstick I'll study #serialize


Posted on: October 26, 2019, 03:05:22 15:05 - Automerged

Hi Max
can you specify a little bit more about you need?
Do you change the MAC address in the source code before reprogram the device or you want a kind of automatic change of the MAC address?
In the first case, you can use a variable, the EEprom memory or the flash memory to write the new address.
You can use also a function that returns the MAC address.
In the second case, I don't think that CCS can insert this value for you in the source code.
If you want a sort of automatism you can use, for example. AutoIt to change the MAC address in your source code Before every reprogram.
Is it possible that I did not well understand your need, sorry for my suggestions in this case.



I'm trying to do a source code that it changes every time I program a device
Logged
microstick
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 107
-Receive: 10


« Reply #6 on: October 26, 2019, 10:48:48 22:48 »

If you need to do that, use (buy) ICD from CCSINFO (or Mouser or anybody else), and use it. Works for me very well
Logged
M@X77
Junior Member
**
Offline Offline

Posts: 54

Thank You
-Given: 46
-Receive: 6


« Reply #7 on: October 29, 2019, 02:15:11 14:15 »

If you need to do that, use (buy) ICD from CCSINFO (or Mouser or anybody else), and use it. Works for me very well

I'he already bought it and works fine, but is the first time that I need to do different device with different address.
Logged
microstick
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 107
-Receive: 10


« Reply #8 on: October 29, 2019, 05:43:40 17:43 »

it is a kind of serial number
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC