presto_en.pdf - 第67页
Page 67 b i t 3 = 1 b o o t m e m o r y ( M S P 4 3 0 , C C 4 3 0 ) 6 s e e b e l o w v e r i f i c a t i o n b i t 0 = 1 c o d e / m a i n m e m o r y b i t 1 = 1 d a t a m e m o r y ( E E P R O M ) b i t 2 = 1 c o n f …

Page 66
5.7
Running UP by Means
of Windows Messages
The UP program can be controlled by means of messages
of the Windows operating system. The running instance of
UP executes the requested command immediately after
message receipt.
Messages must be sent to "up v1.x" class window. The
message type is always of WM_USER.
Commands are identified by “wParam” while parameters
by “lParam”.
5.7.1 List of Commands
Unless specified otherwise, the command returns to its
return value:
0 error, failed
1 everything worked OK
Commands with a wParam of 1, 2, 3, 4, 5, 6, 7 and 24 are
thread blocking.
wParam
lParam
Description
0
0
does not perform anything, returns 1
1
SetForegroundWindow()
2
Maximize, SetForegroundWindow()
1
any
programs everything, same return code as
from the command line
2
any
programming excl. data memory, same
return code as from the command line
3
see
below
programming incl. erasing, same return code
as from the command line
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 2 = 1
configuration memory
bit 3 = 1
boot memory (MSP430, CC430)
4
see
below
reading
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 2 = 1
configuration memory
bit 3 = 1
boot memory (MSP430, CC430)
5
see
below
differential programming
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 2 = 1
configuration memory

Page 67
bit 3 = 1
boot memory (MSP430, CC430)
6
see
below
verification
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 2 = 1
configuration memory
bit 3 = 1
boot memory (MSP430, CC430)
7
see
below
erasing, same return code as from the
command line
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 3 = 1
boot memory (MSP430, CC430)
8
see
below
BlankCheck of memory, same return code as
from the command line
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 2 = 1
configuration memory
bit 3 = 1
boot memory (MSP430, CC430)
15
any
presses the GO button, returns 1
16
see
below
asks if the programmer supports the function
0
MCLRControl_Run
1
MCLRControl_Stop
2
MCLRControl_Reset
8
current voltage at pin VDD
17
see
below
performs the programmer function
0
MCLRControl_Run
1
MCLRControl_Stop
2
MCLRControl_Reset
8
current voltage at pin VDD
return value PRESTO:
0 – unknown level
1 – 0 V
2 – approx. 2 V
3 – approx. 5V
4 – more than 6V
return value FORTE:
-1 - measuring error
xx - measured voltage × 10
example: 33 means 3.3V
24
address
reads data from address, returns error code,
data are returned with wParam = 25
25
any
returns last data read with wParam of 24
32
see
below
UP program initialization
bit 0 = 1
reload settings (reload project/ini file or
registry)
bit 1 = 1
reload language file
bit 2 = 1
recreate programmer (like programmer was
changed)
bit 3 = 1
reload programmer settings (like port
settings)
bit 4 = 1
reload selected device
bit 5 = 1
reload current file (.hex, .bin, ...)
bit 6 = 1
recreate all dialog windows (adjust their size
when reloading device)
0x 0100
refresh device specific windows
0x 0200
refresh all editors
0x 0300
refresh project captions
33
1
save all project settings
48
see
below
1
saves current file (same as Ctrl+S), returns 0
when there was no error else returns a
nonzero value
bit 0 = 1
code/main memory
bit 1 = 1
data memory (EEPROM)
bit 2 = 1
configuration memory
bit 3 = 1
boot memory (MSP430, CC430)
56
0
returns the handle of the UP main form
Table9: Commands WM_USER
A message of the WM_CLOSE type closes the UP
program.

Page 68
Example of use
var
window:HWND;
begin
window:=FindWindow('upv1.x',nil);
Result:=SendMessage(window,
WM_USER,0,0);
end.
1
Only parameter lParam=1 or lParam=2 are allowed for
AVR microcontrollers.
5.8
UP_DLL.DLL Library
Thanks to this library strings can be exchanged with the
UP program.
As the library needs to communicate with UP, the
program must be running. UP_DLL cannot work on its
own.
unitup_dll;
interface
FunctionUP_LoadFile(FileName:PChar;style:in
teger):integer;stdcall;
(*
*LoadFile(withextension.hexor.ppr);
*Loadingof.pprfilecanresultinloading.he
xfiletoo;
*Resultcodesaresamelikeoncommand
*line.
*
*Style|
=1;UPwillbequietonfileloaderrors
*Style|
=2;UPwilldonopreviousfilesaving
*
*)
FunctionUP_GetStrValue(ValueName:PChar;Value:
PChar;Size:integer):integer;stdcall;
FunctionUP_GetIntValue(ValueName:PChar;varVa
lue:integer):LongBool;stdcall;
FunctionUP_SetStrValue(ValueName:PChar;Value:
PChar):LongBool;stdcall;
FunctionUP_SetIntValue(ValueName:PChar;Value:
integer):LongBool;stdcall;
FunctionUP_LoadFile_Wnd(WndClass:PChar;FileNam
e:PChar;style:integer):integer;stdcall;
FunctionUP_SetStrValue_Wnd(WndClass:PChar;Valu