Index: branch/best/sp4c12/SP4b1/SP4b1/SP4b1.hwp
===================================================================
--- branch/best/sp4c12/SP4b1/SP4b1/SP4b1.hwp	(revision 871)
+++ branch/best/sp4c12/SP4b1/SP4b1/SP4b1.hwp	(revision 872)
@@ -122,8 +122,8 @@
 [GENERAL_DATA_SESSION_SessionM32C_E8a_SYSTEM]
 [GENERAL_DATA_SESSION_SessionM32C_Simulator]
 [OPTIONS_Debug_Renesas M32C Assembler]
-"Assembly source file" "092c69e04b757d10" 2 
-"D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\ncrt0.a30" "092c69e04b757d10" 2 
+"Assembly source file" "0ce689d0d7c57d10" 2 
+"D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\ncrt0.a30" "0ce689d0d7c57d10" 2 
 [OPTIONS_Debug_Renesas M32C C Compiler]
 "C source file" "092c69e04b757d10" 1 
 "D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\SP4b1.c" "092c69e04b757d10" 1 
@@ -140,9 +140,10 @@
 "[V|VERSION|1] [B|COMMAND|1] [S|SPEC|UITRON3] " 6 
 "[V|VERSION|1] [B|DATALENGTH|1] [S|OUTPUT|^"$(CONFIGDIR)\$(PROJECTNAME).mot^"] " 4 
 "[V|VERSION|1] [B|STARTUPLINK|1] [B|DEBUG|1] [B|MAP-S|1] [S|OUTPUT|^"$(CONFIGDIR)\$(PROJECTNAME).x30^"] [S|INPUTLIBRARY|^"L=nc382lib^"] [S|CPU|M32C80] " 3 
-"[V|VERSION|1] [S|LIST|LM] [B|INSPECTOR|1] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(FILELEAF).r30^"] [S|CPU|M32C80] [B|HEAP|1] [S|DEFINE|__USTACKSIZE__=0300H] [S|DEFINE|__ISTACKSIZE__=0300H]" 2 
 "[V|VERSION|1] [S|MODE|CREATE|] [S|OUTPUT|^"$(CONFIGDIR)\$(PROJECTNAME).lib^"] " 5 
 "[V|VERSION|1] [S|OUTPUT|OBJECTCODE] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(FILELEAF).r30^"] [B|INSPECTOR|1] [S|CPU|M32C80] " 1 
+"[V|VERSION|2] [S|DEFINE|__USTACKSIZE__=0300H|__ISTACKSIZE__=0300H|__MVT__=1] [B|HEAP|1] [B|INSPECTOR|1] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(FILELEAF).r30^"] [S|LIST|L|M] [S|CPU|M32C80]
+" 2 
 [EXCLUDED_FILES_Debug]
 [LINKAGE_ORDER_Debug]
 "D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\Debug\ncrt0.r30" 
Index: branch/best/sp4c12/SP4b1/SP4b1/SessionM32C_E8a_SYSTEM.hsf
===================================================================
--- branch/best/sp4c12/SP4b1/SP4b1/SessionM32C_E8a_SYSTEM.hsf	(revision 871)
+++ branch/best/sp4c12/SP4b1/SP4b1/SessionM32C_E8a_SYSTEM.hsf	(revision 872)
@@ -8,6 +8,7 @@
 "" 
 [GENERAL_DATA]
 "FIRST_CONNECTION_TAG" "NO" 
+"MRULABELS_DATAMANAGER_KEY" "404|FFFFFF|000000" 
 "RESET_CPU_AFTER_DOWNLOAD_TAG" "VARIANT_TRUE_STORE_TAG" 
 "{287A8023-99B5-49E1-A54E-4DDCA43D7959}MapCtrlECX_MAP_FIND_SYMBOL_LIST" "" 
 "{287A8023-99B5-49E1-A54E-4DDCA43D7959}MapCtrlViews" "0" 
@@ -26,9 +27,9 @@
 "{313F4FC1-6566-11D5-8BBE-0004E2013C71}TclTkCtrlLogFileName" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_COMPARE_END_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_COMPARE_START_ADDRESS" "" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_DEST_ADDRESS" "" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_END_ADDRESS" "" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_START_ADDRESS" "" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_DEST_ADDRESS" "000000" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_END_ADDRESS" "FFFFFF" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_START_ADDRESS" "000000" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_FILL_END_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_FILL_START_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_MOVE_END_ADDRESS" "" 
@@ -38,7 +39,45 @@
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_SET_DEST_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_TEST_END_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_TEST_START_ADDRESS" "" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryCtrlViews" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryCtrlViews" "1" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0AutoRefreshEnableTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0AutoRefreshIntervalTopPane" "100" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0DataLength" "1" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0DispAddressTopPane" "1028" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0DispCode" "42208" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0DispColumnCount" "16" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0IsDispCode" "1" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0IsDispFloat" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0IsDispLabel" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0IsDispRegister" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0IsRegFollowEnableTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0LabelWidth" "96" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0Radix" "16" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0RegFollowRegTblIDTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0RegisterWidth" "96" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0ScrollEndAddress" "16777215" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0ScrollStartAddress" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewA0StartUpSymbolTopPane" "" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewAInstanceKey0" "{WK_00000001_MEMORY}SP4b1SessionM32C_E8a_SYSTEM" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0AutoRefreshEnableTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0AutoRefreshIntervalTopPane" "100" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0DataLength" "1" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0DispAddressTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0DispCode" "42208" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0DispColumnCount" "16" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0IsDispCode" "1" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0IsDispFloat" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0IsDispLabel" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0IsDispRegister" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0IsRegFollowEnableTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0LabelWidth" "96" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0Radix" "16" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0RegFollowRegTblIDTopPane" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0RegisterWidth" "96" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0ScrollEndAddress" "16777215" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0ScrollStartAddress" "0" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewB0StartUpSymbolTopPane" "" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}MemoryWndViewBInstanceKey0" "{WK_00000001_MEMORY}SP4b1SessionM32C_E8a_SYSTEMViewB" 
 "{4B022541-3E95-11D7-909C-00201898052D}ElfDwarf2Objects" "1" 
 "{4B022541-3E95-11D7-909C-00201898052D}LoadModule0OBJ_ELFDWARF2_ARRAY_EXPAND_LIMIT" "-1" 
 "{4B022541-3E95-11D7-909C-00201898052D}LoadModule0OBJ_STATUS_OF_EBD_CMD" "0" 
@@ -45,20 +84,20 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRCtrlViews" "0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_DENORMAL_MODE" "0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_ROUND_MODE" "0" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "000000000000000A" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "000000000000000A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_10" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_12" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000400" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FE034A" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFFD00" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000686" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000A02" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FFFFFF" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000C400" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "000000000000008C" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_23" "0000000000000000" 
@@ -75,10 +114,10 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_33" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "00000000000006AA" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000020000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "000000000000069A" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000400" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_COUNT" "36" 
@@ -91,7 +130,23 @@
 "{8A898260-6F1D-11D5-8EB6-00004CC34E9D}ECX_WAVE_COMB_BUFFER" ",,,," 
 "{8A898260-6F1D-11D5-8EB6-00004CC34E9D}ECX_WAVE_SAMPLING_RATE" "1000" 
 "{8A898260-6F1D-11D5-8EB6-00004CC34E9D}WaveformCtrlViews" "0" 
-"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersCtrlViews" "0" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersCtrlViews" "1" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0ColumnWidth" "51,64,37" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0ECX_REGISTER_COUNT" "36" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0ECX_REGISTER_DISPLAYED" "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0HideFLAGs" "0" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0HideRadix" "0" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0LastFileName" "" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWnd0RadixList" "16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,2,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16," 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndInstanceKey0" "{WK_00000001_REGISTERS}SP4b1SessionM32C_E8a_SYSTEM" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0ColumnWidth" "51,64,37" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0ECX_REGISTER_COUNT" "36" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0ECX_REGISTER_DISPLAYED" "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0HideFLAGs" "0" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0HideRadix" "0" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0LastFileName" "" 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewB0RadixList" "16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,2,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16," 
+"{95A081A1-7001-11D5-B1FD-00A0C9E23A58}RegistersWndViewBInstanceKey0" "{WK_00000001_REGISTERS}SP4b1SessionM32C_E8a_SYSTEMViewB" 
 "{AC411480-6F0A-11D5-8EB6-00004CC34E9D}ECX_IMAGE_ADDRESS_NAME" "" 
 "{AC411480-6F0A-11D5-8EB6-00004CC34E9D}ECX_IMAGE_BUFFER" "00000000,00000000,0,0" 
 "{AC411480-6F0A-11D5-8EB6-00004CC34E9D}ECX_IMAGE_COLOR" "0,0,0,0" 
@@ -108,13 +163,17 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth12" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth2" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth3" "200" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "checksum, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "i, 10, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "i, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "trame_ok, 1, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "trame_ok, 1, 0, P, Col, Hex, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "Etat, 1, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "3" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "checksum_cal, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "Buffer, 6, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "5" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "150" 
@@ -167,8 +226,10 @@
 0 
 [WINDOW_POSITION_STATE_DATA_VD1]
 "Help" "TOOLBAR 0" 59419 1 5 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 0 "0.61" 180 683 371 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
-"{WK_00000001_WATCH}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 1 "0.39" 180 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32829|32772|32827|32773|<<separator>>|32786|<<separator>>|32810|32811|32831" "0.0" 
+"{WK_00000001_MEMORY}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 0 "0.50" 133 0 0 350 200 18 0 "42202|42203|42204|42233|<<separator>>|42206|42205|42230|42229|42207|<<separator>>|42208|42209|42210|49076|42228|42227|<<separator>>|42231|42232|42234|42235|<<separator>>|42211|<<separator>>|32796|32797" "0.0" 
+"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 1 "0.24" 133 683 371 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
+"{WK_00000001_REGISTERS}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59421 0 0 "1.00" 545 0 0 350 200 18 0 "" "0.0" 
+"{WK_00000001_WATCH}SP4b1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 2 "0.26" 133 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32829|32772|32827|32773|<<separator>>|32786|<<separator>>|32810|32811|32831" "0.0" 
 "{WK_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 180 683 371 350 200 18 0 "" "0.0" 
 "{WK_TB00000001_STANDARD}" "TOOLBAR 0" 59419 0 2 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
 "{WK_TB00000002_EDITOR}" "TOOLBAR 0" 59419 0 0 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
@@ -194,6 +255,7 @@
 [WINDOW_Z_ORDER]
 "D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\SP4b1.c" 
 "D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\ncrt0.a30" 
+"D:\tp_sp4_2021_best\sp4c12\SP4b1\SP4b1\sfr32c87.h" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
Index: branch/best/sp4c12/SP4b1/SP4b1/SP4b1.c
===================================================================
--- branch/best/sp4c12/SP4b1/SP4b1/SP4b1.c	(revision 871)
+++ branch/best/sp4c12/SP4b1/SP4b1/SP4b1.c	(revision 872)
@@ -13,32 +13,27 @@
 void uart0_init(void); // Initialisation du port série
 void uart0_tx(char c); //Envoie d'un caractère
 char uart0_rx(void); //Fonction d'attente et lecture d'un caractère
-int rectramev1(char * Buffer);
-int rectramev2(char * Buffer);
+int rectrame(char * Buffer);
 void irectramev1(char * Buffer);
+void irectramev2(char * Buffer);
 int hex2int(char *c); //Passage hexa en int
+void uart0_inter_init(void); //Initialisation interruption
 
 /*Variable Globale*/
 int trame_ok;
 int Etat = 0; //0->synchronisation, 1->reception, 2->checksum, 3->validation
+char Buffer[128];
+//char * Buffer;
 
 void main(void)
 {
-	char Buffer[80];
+	//char Buffer[80];
 	
-	uart0_init();
-	while(1){
-		uart0_tx(rectramev1(Buffer)+48);
-		if (trame_ok == 1){
-			uart0_tx('O');
-			uart0_tx('K');
-		}
-		else{
-			uart0_tx('N');
-			uart0_tx('O');
-			uart0_tx('N');
-		}
-	}
+	uart0_inter_init();
+	/*while(1){
+		//uart0_tx(rectrame(Buffer)+48);
+		//irectramev1(Buffer);
+	}*/
 }
  
  
@@ -55,6 +50,37 @@
 	ps0_3 = 1;
 }
 
+void uart0_inter_init(void){
+	u0mr = 0x05;
+	
+	u0smr = 0x00;
+	u0smr2 = 0x00;
+	u0smr3 = 0x00;
+	u0smr4 = 0x00;
+	
+	u0c0 = 0x11;
+	
+	u0brg = 32;
+	
+	u0c1 = 0x10;
+	
+	pd6_0 = 0;
+	pd6_1 = 0;
+	pd6_2 = 0;
+	pd6_3 = 1;
+	psl0 &= ~(1<<3); 
+	ps0_3 = 1;
+	
+	s0tic = 0x01;
+	s0ric = 0x01;
+	
+	asm("FSET I");
+	
+	te_u0c1 = 1;
+	re_u0c1 = 1;
+	
+}
+
 void uart0_tx(char c){
 	while (ti_u0c1 != 1); 
 	u0tb = c;
@@ -65,7 +91,7 @@
 	return u0rb;	
 }
 
-int rectramev1(char * Buffer){
+int rectrame(char * Buffer){
 	int i;
 	char checksum;
 	char carac_recu;
@@ -93,26 +119,17 @@
 	return i;
 }
 
-/*int rectramev2(char * Buffer){
+void irectramev1(char * Buffer){
 	int i;
 	char c;
+	char checksum_cal;
+	char checksum_trame[3];
+	char checksum_trame_conv;
+	int nb_car_checksum_recu;
+	
 	while(1){
+		while(!ri_u0c1);
 		c = u0rb;
-		if (c == '&'){
-			
-		}
-	}
-	
-	return i;
-}*/
-
-void irectramev1(char * Buffer){
-	int i;
-	char c;
-	char checksum_trame;
-	while(1){
-		
-		c = uart0_rx();
 		switch(Etat){
 			
 			case 0 : //Synchro
@@ -120,9 +137,10 @@
 				if (c == '$'){
 					
 					i = 0;
-					checksum_trame = 0;
+					checksum_cal = 0;
 					Etat = 1;
 				}
+				break;
 			
 			case 1 : //Reception
 				
@@ -129,25 +147,124 @@
 				if (c != '*'){
 				
 					Buffer[i++] = c;
-					checksum_trame ^= c;
+					checksum_cal ^= c;
 						
 				}
 				else{
 				
+					nb_car_checksum_recu = 0;
+					checksum_trame_conv = 0;
 					Etat = 2;	
 				}
+				break;
 				
 			case 2 : //checksum
 				
+				checksum_trame[nb_car_checksum_recu] = c;
+				nb_car_checksum_recu += 1;
+				
+				if (nb_car_checksum_recu == 2){
 					
+					checksum_trame_conv = hex2int(checksum_trame);
+					Etat = 3;
+					
+				}
+				
+				
+				break;
+				
+			case 3 : //Validation
 			
-			
-			
+				if (checksum_trame_conv == checksum_cal){
+					
+					trame_ok = 1;
+					Etat = 0;
+				}
+				
+				else{
+					
+					trame_ok = 0;
+					Etat = 0;
+				}
+				break;
 		}
 		
 	}
 }
 
+#pragma INTERRUPT 18 irectramev2;
+
+void irectramev2(/*char * Buffer*/){
+	static int i;
+	char c;
+	static char checksum_cal;
+	static char checksum_trame[3];
+	static char checksum_trame_conv;
+	static int nb_car_checksum_recu;
+	
+
+	c = u0rb;
+	switch(Etat){
+			
+		case 0 : //Synchro
+				
+			if (c == '$'){
+					
+				i = 0;
+				checksum_cal = 0;
+				Etat = 1;
+			}
+			break;
+			
+		case 1 : //Reception
+				
+			if (c != '*'){
+				
+				Buffer[i++] = c;
+				checksum_cal ^= c;
+						
+			}
+			else{
+				
+				nb_car_checksum_recu = 0;
+				checksum_trame_conv = 0;
+				Etat = 2;	
+			}
+			break;
+				
+		case 2 : //checksum
+				
+			checksum_trame[nb_car_checksum_recu] = c;
+			nb_car_checksum_recu += 1;
+				
+			if (nb_car_checksum_recu == 2){
+					
+				checksum_trame_conv = hex2int(checksum_trame);
+				Etat = 3;
+					
+			}
+				
+				
+			break;
+				
+		case 3 : //Validation
+			
+			if (checksum_trame_conv == checksum_cal){
+					
+				trame_ok = 1;
+				Etat = 0;
+			}
+				
+			else{
+					
+				trame_ok = 0;
+				Etat = 0;
+			}
+			break;
+	}
+}
+
+
 int hex2int(char *c)
 {
 	int i=0;
@@ -165,92 +282,4 @@
 		}
 	}
 	return(c[1]+16*c[0]);
-}
-/*
-typedef enum{synchronisation , reception , checksum , validation}etat_machine;
-etat_machine etat=synchronisation;
-
-
-int RecTrame(char*Buffer)
-{
-	//declaration des variables
-	int nombre_caractere_apres_etoile=0;
-	int k=0; //pour le test
-	int nombre_cararactere=0;
-	char caractere_recu;
-	char checksum_trame=0;
-	char checksum_fin_trame[3];
-	char checksum_calculer=0;
-
-	while(1)
-	{
-		//caractere_recu = uart0_rx();
-		caractere_recu = trame1[k];
-		k++;
-
-		switch(etat)
-		{
-			case synchronisation :
-					if(caractere_recu == '$')
-					{
-						nombre_cararactere = 0;
-						etat=reception;
-						checksum_trame = 0;
-					}
-					break;
-
-			case reception :
-				if(caractere_recu != '*')
-				{
-				    //placement du caractere recu de la trame dans le Buffer
-					Buffer[nombre_cararactere] = caractere_recu;
-					nombre_cararactere++;
-				//verification du checksum à chaque caractere recu
-					checksum_trame ^= caractere_recu;
-					nombre_caractere_apres_etoile = 0;
-				}
-				else
-				{
-				    //passage à l'etat cheksum quand la trame est memorisée
-					etat = checksum;
-				}
-				break;
-
-			case checksum :
-		                            //récupération du checksum de la trame (2derniers caractères)
-			checksum_fin_trame[nombre_caractere_apres_etoile] = caractere_recu;
-
-                            			//attention, on mémorise deux caractères
-		                                donc, premier caractère -> nombre_caractere_apres_etoile=0
-                             		              deuxième caractère -> nombre_caractere_apres_etoile=1
-		                                soit deux caractères mémorisés après la virgule
-
-				if(nombre_caractere_apres_etoile == 2)
-				{
-					    etat = validation;
-					checksum_calculer = hex_int(checksum_fin_trame);
-				}
-
-				nombre_caractere_apres_etoile++;
-				break;
-
-			case validation :
-		                            //comparaison du checksum_trame et checksum_calculer
-                            				si l'égalité est vérifiée alors on retourne le nombre
-		                            de caractère de la trame, sinon on retourne la valeur 0
-
-				if(checksum_trame == checksum_calculer)
-				{
-					etat = synchronisation;
-					return nombre_cararactere;
-				}
-				else
-				{
-					etat = synchronisation;
-					return 0;
-				}
-				break;
-		}
-	}
-}
-*/
\ No newline at end of file
+}
\ No newline at end of file
