This turns the light on:
Poke8(0xC0220020, 0x46)
Poke8(0xC022C0CC, 0x46)
This turns the light off:
Poke8(0xC0220020, 0x44)
Poke8(0xC022C0CC, 0x44)
The way I went about finding this was a bit different than what I'm seeing on the forum. Most scripts would poke a range of addresses which would lead to unusual results. One script would actually turn the lights on and off but didn't tell you the address. My thought was why not combine the scripts together and see what happens.
Step 1: Run the script below
private sub Initialize()
System.Create()
Driver.Create()
UI.CreatePublic()
a=LCDMsg_Create()
LCDMsg_SetStr(a,"LED Test")
LCDMsg_Move(a,100,100)
LCDMsg_ChangeColor(a,3)
b=LCDMsg_Create()
for c=0 to 15
LCDMsg_SetNum(b,c)
LCDMsg_Move(b,100,200)
LCDMsg_ChangeColor(b,2)
BeepDrive(3)
Wait(500)
LEDDrive(c,0)
Wait(2000)
LEDDrive(c,1)
next
Wait(2000)
LCDMsg_SetStr(a,"Test End")
end sub
private sub terminate( )
' Ending code
end sub
On a piece of paper I wrote down the different lights LED, WIFI, AF and then as this script ran I noted the number that was being used to turn which lights on/off.
I then compiled a list of all the LED locations from all IV & V chip cameras to make a range of addresses to search as most were doing. The difference in my script is that instead of randomly Poke8 to each address which causes the camera to lock up I just Peek8 the address and dump it to the SD card.
Step 2: Modify and run this script with c=number of the light you'd like to test. On the ELPH320HS a zero '0' would turn the power LED on/off in the first script.
private sub Initialize()
'Starting memory address
startaddy=0xC0220000
'Ending memory address
maxaddy=0xC022FFFF
'ELPH320HS Light 0=I/O, 4-6=AF, 8=WIFI
c=0
System.Create()
Driver.Create()
UI.CreatePublic()
msgstr = AllocateMemory(80)
a=LCDMsg_Create()
LCDMsg_Move(a,100,100)
LCDMsg_ChangeColor(a,3)
LCDMsg_SetStr(a,"LED TEST")
BeepDrive(3)
Wait(500)
'Dump memory address:value to file0
msgfile = Fopen_Fut("A/MEMORY0.LOG","a")
for x = startaddy to maxaddy
d = Peek8(x)
sprintf(msgstr,"%0X:%0X", x, d)
LCDMsg_SetStr(a,msgstr)
if msgfile <> 0 then
Fwrite_Fut(msgstr,strlen(msgstr),1,msgfile)
Fwrite_Fut("\n",1,1,msgfile)
end if
next
Fclose_Fut(msgfile)
'Turn on LED
LEDDrive(c,0)
'Dump memory address:value to file1
msgfile = Fopen_Fut("A/MEMORY1.LOG","a")
for x = startaddy to maxaddy
d = Peek8(x)
sprintf(msgstr,"%0X:%0X", x, d)
LCDMsg_SetStr(a,msgstr)
if msgfile <> 0 then
Fwrite_Fut(msgstr,strlen(msgstr),1,msgfile)
Fwrite_Fut("\n",1,1,msgfile)
end if
next
Fclose_Fut(msgfile)
'Turn off LED
LEDDrive(c,1)
Wait(500)
LCDMsg_SetStr(a,"Test End")
FreeMemory(msgstr)
end sub
private sub terminate( )
' Ending code
end sub
After running this (IT WILL TAKE A WHILE) I then have 2 files on the SD card MEMORY0.LOG & MEMORY1.LOG. In each of these files there is a list of addresses and their values:
....
C022E150:FFFFFFF3
C022E151:3
C022E152:7
C022E153:FFFFFFC0
....
Step 3: Using the 'diff' command in linux I then compared both files together and saw some interesting output:
mbp:Cannon Camera/LED#diff MEMORY0.LOG MEMORY1.LOG
29c29
< C022001C:9
---
> C022001C:8
33c33
< C0220020:0
---
> C0220020:1
277c277
< C0220114:9
---
> C0220114:8
514c514
< C0220201:C
---
> C0220201:D
521c521
< C0220208:C
---
> C0220208:3C
49357c49357
< C022C0CC:8
---
> C022C0CC:9
Step 4: I then took all the distinct addresses above and put them into a third script
private sub Initialize()
System.Create()
Driver.Create()
UI.CreatePublic()
a=LCDMsg_Create()
LCDMsg_SetStr(a,"LED Test")
LCDMsg_Move(a,100,100)
LCDMsg_ChangeColor(a,3)
b=LCDMsg_Create()
for c=0 to 10
BeepDrive(3)
Wait(500)
Poke8(0xC022001C, 0x46)
Poke8(0xC0220020, 0x46)
Poke8(0xC0220114, 0x46)
Poke8(0xC0220201, 0x46)
Poke8(0xC0220208, 0x46)
Poke8(0xC022C0CC, 0x46)
Poke8(0xC022F484, 0x46)
Poke8(0xC022F485, 0x46)
Poke8(0xC022F486, 0x46)
Poke8(0xC022F48E, 0x46)
Poke8(0xC022F4A4, 0x46)
Poke8(0xC022F4A5, 0x46)
Poke8(0xC022F4A6, 0x46)
Poke8(0xC022F4A7, 0x46)
Poke8(0xC022F5E4, 0x46)
Wait(500)
Poke8(0xC022001C, 0x44)
Poke8(0xC0220020, 0x44)
Poke8(0xC0220114, 0x44)
Poke8(0xC0220201, 0x44)
Poke8(0xC0220208, 0x44)
Poke8(0xC022C0CC, 0x44)
Poke8(0xC022F484, 0x44)
Poke8(0xC022F485, 0x44)
Poke8(0xC022F486, 0x44)
Poke8(0xC022F48E, 0x44)
Poke8(0xC022F4A4, 0x44)
Poke8(0xC022F4A5, 0x44)
Poke8(0xC022F4A6, 0x44)
Poke8(0xC022F4A7, 0x44)
Poke8(0xC022F5E4, 0x44)
next
Wait(1000)
LCDMsg_SetStr(a,"Test End")
end sub
private sub terminate( )
' Ending code
end sub
Running this all sorts of chaos was observed on the camera including a flashing LED. I then started commenting out each set of Poke's starting at the top and working my way down the list and found the 2 addresses above were required to make the light blink on and off.
By using this method I believe it will save a great deal of time and repetitive testing and narrow down the addresses to only a handful that need checked as opposed to huge ranges.