diff options
author | Rr42 | 2018-06-06 12:33:47 +0530 |
---|---|---|
committer | Rr42 | 2018-06-06 12:33:47 +0530 |
commit | 0c37bab6d63de075911db1147e38c2f9e2283d6f (patch) | |
tree | 0eb4b7567655ef502d89c832968b21340fa7fe1f | |
parent | 86b0579d383105db5e5fa8e3e4cbbbf428ededf5 (diff) | |
parent | 6be3a6d8b3b7912948936090f3205865395d8474 (diff) | |
download | LDMicroGtk-0c37bab6d63de075911db1147e38c2f9e2283d6f.tar.gz LDMicroGtk-0c37bab6d63de075911db1147e38c2f9e2283d6f.tar.bz2 LDMicroGtk-0c37bab6d63de075911db1147e38c2f9e2283d6f.zip |
Merge branch 'Core_port' into GUI_port
64 files changed, 11306 insertions, 3858 deletions
diff --git a/ldmicro/CMakeLists.txt b/ldmicro/CMakeLists.txt index 5486fec..9af4450 100644 --- a/ldmicro/CMakeLists.txt +++ b/ldmicro/CMakeLists.txt @@ -60,10 +60,43 @@ IF(UNIX) ## Dummy compile and install to test linuxUI ## to compile LDmicro uncomment the below 2 line2 - #add_executable (LDMicro ldmicro.cpp)# miscutil.cpp draw_outputdev.cpp) - # install (TARGETS LDMicro DESTINATION bin) - add_executable (testMain testMain.cpp) - target_link_libraries (testMain LinuxUI) - target_link_libraries (testMain FreezeLD) - install (TARGETS testMain DESTINATION bin) + set (COMPILE_CPP_SOURCES windows.cpp + #naminglist.cpp + #componentimages.cpp + #componentlist.cpp + #advanceddialog.cpp + arduino.cpp + avr.cpp + pic16.cpp + interpreted.cpp + ansic.cpp + compilecommon.cpp + intcode.cpp + lang.cpp + miscutil.cpp + iolist.cpp + #confdialog.cpp + #lutdialog.cpp + #resetdialog.cpp + #simpledialog.cpp + #coildialog.cpp + #contactsdialog.cpp + #commentdialog.cpp + #simulate.cpp + loadsave.cpp + undoredo.cpp + circuit.cpp + draw_outputdev.cpp + #draw.cpp + schematic.cpp + #helpdialog.cpp + maincontrols.cpp + ldmicro.cpp) + + add_executable (LDMicro ${COMPILE_CPP_SOURCES}) + install (TARGETS LDMicro DESTINATION bin) + #add_executable (testMain testMain.cpp) + target_link_libraries (LDMicro LinuxUI) + target_link_libraries (LDMicro FreezeLD) + #install (TARGETS testMain DESTINATION bin) ENDIF(UNIX) diff --git a/ldmicro/RCa02300 b/ldmicro/RCa02300 Binary files differdeleted file mode 100644 index fd5b9e5..0000000 --- a/ldmicro/RCa02300 +++ /dev/null diff --git a/ldmicro/ansic.cpp b/ldmicro/ansic.cpp index d0fe240..ca13836 100644 --- a/ldmicro/ansic.cpp +++ b/ldmicro/ansic.cpp @@ -22,7 +22,7 @@ // responsible for calling us with appropriate timing. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <setjmp.h> #include <stdlib.h> diff --git a/ldmicro/arduino.cpp b/ldmicro/arduino.cpp index 0e1db36..af8090b 100644 --- a/ldmicro/arduino.cpp +++ b/ldmicro/arduino.cpp @@ -4,7 +4,7 @@ // runtime needed to schedule the cycles. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> #include <setjmp.h> #include <stdlib.h> diff --git a/ldmicro/avr.cpp b/ldmicro/avr.cpp index e4e2bc9..848426d 100644 --- a/ldmicro/avr.cpp +++ b/ldmicro/avr.cpp @@ -22,7 +22,7 @@ // runtime needed to schedule the cycles. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> #include <setjmp.h> #include <stdlib.h> diff --git a/ldmicro/circuit.cpp b/ldmicro/circuit.cpp index 82d8414..1d9d3d7 100644 --- a/ldmicro/circuit.cpp +++ b/ldmicro/circuit.cpp @@ -21,7 +21,7 @@ // particular point, delete the selected element, etc. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> #include <stdlib.h> diff --git a/ldmicro/coildialog.cpp b/ldmicro/coildialog.cpp index fa4228c..070dd42 100644 --- a/ldmicro/coildialog.cpp +++ b/ldmicro/coildialog.cpp @@ -21,9 +21,9 @@ // plus the name, plus set-only or reset-only // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> -#include <commctrl.h> +//#include <commctrl.h> #include "ldmicro.h" diff --git a/ldmicro/commentdialog.cpp b/ldmicro/commentdialog.cpp index a1f1e06..4cfe13b 100644 --- a/ldmicro/commentdialog.cpp +++ b/ldmicro/commentdialog.cpp @@ -21,9 +21,9 @@ // encourage people to write it the way it will look on the diagram. // Jonathan Westhues, Jun 2005 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> -#include <commctrl.h> +//#include <commctrl.h> #include "ldmicro.h" diff --git a/ldmicro/compilecommon.cpp b/ldmicro/compilecommon.cpp index f9f1206..a25d742 100644 --- a/ldmicro/compilecommon.cpp +++ b/ldmicro/compilecommon.cpp @@ -20,7 +20,7 @@ // Routines common to the code generators for all processor architectures. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> #include <stdlib.h> diff --git a/ldmicro/componentimages.cpp b/ldmicro/componentimages.cpp index 2026c7f..063bdbb 100644 --- a/ldmicro/componentimages.cpp +++ b/ldmicro/componentimages.cpp @@ -1,6 +1,6 @@ -#include <windows.h> -#include <commctrl.h> +#include <linuxUI.h> +//#include <commctrl.h> #include <stdio.h> #include <stdlib.h> #include <wincodec.h> diff --git a/ldmicro/componentlist.cpp b/ldmicro/componentlist.cpp index 97c5b7e..56a243e 100644 --- a/ldmicro/componentlist.cpp +++ b/ldmicro/componentlist.cpp @@ -1,5 +1,5 @@ -#include <windows.h> -#include <commctrl.h> +#include <linuxUI.h> +//#include <commctrl.h> #include <stdio.h> #include <stdlib.h> #include <wincodec.h> @@ -15,194 +15,194 @@ // static HBITMAP testmask=NULL; -HIMAGELIST ComponentDiagrams; -static int ComponentCount; -ImageLocation ImageStack[MAX_SCREEN_ITEMS]; -PinInfo PinStack[MAX_PINS]; -int ImagesDrawn = 0; -int DragIndex = 0; -int DragOffsetX = 0; -int DragOffsetY = 0; -int DragX = 0; -int DragY = 0; -BOOL Dragging = FALSE; -UINT UniqueImgId = 0; +// HIMAGELIST ComponentDiagrams; +// static int ComponentCount; +// ImageLocation ImageStack[MAX_SCREEN_ITEMS]; +// PinInfo PinStack[MAX_PINS]; +// int ImagesDrawn = 0; +// int DragIndex = 0; +// int DragOffsetX = 0; +// int DragOffsetY = 0; +// int DragX = 0; +// int DragY = 0; +// BOOL Dragging = FALSE; +// UINT UniqueImgId = 0; // Imagemap test; void ComponentListInitiate(void) { - int i; - LVITEM lvi; - for(i = 0; i < TOTAL_COMPONENTS; i++) - { - lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; - lvi.state = lvi.stateMask = 0; - lvi.iItem = i; - lvi.iSubItem = 0; - lvi.pszText = rgCompData[i].ComponentName; - lvi.lParam = rgCompData[i].Index; - if(ListView_InsertItem(ComponentList, &lvi) < 0) oops(); - } + // int i; + // LVITEM lvi; + // for(i = 0; i < TOTAL_COMPONENTS; i++) + // { + // lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; + // lvi.state = lvi.stateMask = 0; + // lvi.iItem = i; + // lvi.iSubItem = 0; + // lvi.pszText = rgCompData[i].ComponentName; + // lvi.lParam = rgCompData[i].Index; + // if(ListView_InsertItem(ComponentList, &lvi) < 0) oops(); + // } // test.insert(make_pair(1, ComponentDiagrams, 100, 100, 6000)); } void ComponentListProc(NMHDR *h) { - switch(h->code) { - case LVN_ITEMACTIVATE: - { - int Img, Index; - NMITEMACTIVATE *i = (NMITEMACTIVATE *)h; - LVITEM lvi; - lvi.mask = LVIF_PARAM; - lvi.iItem = ListView_GetNextItem(ComponentList, -1, LVNI_SELECTED); - ListView_GetItem(ComponentList, &lvi); - Index = (int) lvi.lParam; - int CompId = rgCompData[Index].ComponentId; - ImageStack[ImagesDrawn].Image = - (ImageStruct *)AllocImageHeap(sizeof(ImageStruct)); - ImageStack[ImagesDrawn].Image->ComponentId = CompId; - ImageStack[ImagesDrawn].Properties = - AllocImageHeap(GetStructSize(CompId)); - ImageStack[ImagesDrawn].PinName = - AllocImageHeap(GetNameSize(Index)); - ImageStack[ImagesDrawn].Id = ++UniqueImgId; - ImageStack[ImagesDrawn].Index = Index; - Img = InitializeComponentProperties( - ImageStack[ImagesDrawn].Properties, CompId); - InitializeImageList(&ImageStack[ImagesDrawn].Image->Images); - InitializeComponentImage(Img, - &ImageStack[ImagesDrawn].Image->Images); - ImageStack[ImagesDrawn].x = 100; - ImageStack[ImagesDrawn].y = 100; - // RECT TempRect; - // GetWindowRect(AdvancedWorkspace, &TempRect); - InvalidateRect(AdvancedWorkspace, NULL, TRUE); - - ImagesDrawn++; - // char a[4]; - // MessageBox(ComponentList, (LPCTSTR)itoa(lvi.lParam, a, 10), "Info", MB_OK | MB_ICONEXCLAMATION); - // InitializeComponentImage((int)lvi.lParam); - // int *temp; - // temp = (int *)i->lParam; - // MessageBox(ComponentList, (LPCTSTR)itoa(*temp, a, 10), "Info", MB_OK | MB_ICONEXCLAMATION); - //Selection Code Here - - // test=LoadComponentImage(RELAY_NC); - // if(test ==NULL){ - // MessageBox(ComponentList, "Could not load Bitmap!", "Error", MB_OK | MB_ICONEXCLAMATION); - // } - } - break; - default: - break; - } + // switch(h->code) { + // case LVN_ITEMACTIVATE: + // { + // int Img, Index; + // NMITEMACTIVATE *i = (NMITEMACTIVATE *)h; + // LVITEM lvi; + // lvi.mask = LVIF_PARAM; + // lvi.iItem = ListView_GetNextItem(ComponentList, -1, LVNI_SELECTED); + // ListView_GetItem(ComponentList, &lvi); + // Index = (int) lvi.lParam; + // int CompId = rgCompData[Index].ComponentId; + // ImageStack[ImagesDrawn].Image = + // (ImageStruct *)AllocImageHeap(sizeof(ImageStruct)); + // ImageStack[ImagesDrawn].Image->ComponentId = CompId; + // ImageStack[ImagesDrawn].Properties = + // AllocImageHeap(GetStructSize(CompId)); + // ImageStack[ImagesDrawn].PinName = + // AllocImageHeap(GetNameSize(Index)); + // ImageStack[ImagesDrawn].Id = ++UniqueImgId; + // ImageStack[ImagesDrawn].Index = Index; + // Img = InitializeComponentProperties( + // ImageStack[ImagesDrawn].Properties, CompId); + // InitializeImageList(&ImageStack[ImagesDrawn].Image->Images); + // InitializeComponentImage(Img, + // &ImageStack[ImagesDrawn].Image->Images); + // ImageStack[ImagesDrawn].x = 100; + // ImageStack[ImagesDrawn].y = 100; + // // RECT TempRect; + // // GetWindowRect(AdvancedWorkspace, &TempRect); + // InvalidateRect(AdvancedWorkspace, NULL, TRUE); + + // ImagesDrawn++; + // // char a[4]; + // // MessageBox(ComponentList, (LPCTSTR)itoa(lvi.lParam, a, 10), "Info", MB_OK | MB_ICONEXCLAMATION); + // // InitializeComponentImage((int)lvi.lParam); + // // int *temp; + // // temp = (int *)i->lParam; + // // MessageBox(ComponentList, (LPCTSTR)itoa(*temp, a, 10), "Info", MB_OK | MB_ICONEXCLAMATION); + // //Selection Code Here + + // // test=LoadComponentImage(RELAY_NC); + // // if(test ==NULL){ + // // MessageBox(ComponentList, "Could not load Bitmap!", "Error", MB_OK | MB_ICONEXCLAMATION); + // // } + // } + // break; + // default: + // break; + // } } void InitializeImageList(HIMAGELIST *il) { - *il = ImageList_Create(COMPONENT_WIDTH, COMPONENT_HEIGHT, ILC_MASK | ILC_COLOR8, 0, MAX_SCREEN_ITEMS); - if(*il == NULL){ - MessageBox(ComponentList, "Could not Initialize ImageList", "Error", MB_OK | MB_ICONEXCLAMATION); - return; - } + // *il = ImageList_Create(COMPONENT_WIDTH, COMPONENT_HEIGHT, ILC_MASK | ILC_COLOR8, 0, MAX_SCREEN_ITEMS); + // if(*il == NULL){ + // MessageBox(ComponentList, "Could not Initialize ImageList", "Error", MB_OK | MB_ICONEXCLAMATION); + // return; + // } } void RefreshImages() { - InvalidateRect(AdvancedWorkspace, NULL, TRUE); + // InvalidateRect(AdvancedWorkspace, NULL, TRUE); } void SetImage(int Component, void *il) { - InitializeComponentImage(Component,(HIMAGELIST*) il); + // InitializeComponentImage(Component,(HIMAGELIST*) il); } int BeginComponentDrag(int x, int y) { - int i; - for(i = 0; i < ImagesDrawn; i++) - { - if((((ImageStack[i].x + COMPONENT_WIDTH) > x) && (ImageStack[i].x < x) - && (ImageStack[i].y < y) && ((ImageStack[i].y + COMPONENT_HEIGHT) > y))) - { - // RECT TempRect; - // TempRect.left = ImageStack[i].x; - // TempRect.top = ImageStack[i].y; - // TempRect.right = ImageStack[i].x + 100; - // TempRect.bottom = ImageStack[i].y + 100; - - DragOffsetX = x - ImageStack[i].x; - DragOffsetY = y - ImageStack[i].y; - DragX = x; - DragY = y; - - // MessageBox(ComponentList, "Clicked Image", "Error", MB_OK | MB_ICONEXCLAMATION); - ImageList_BeginDrag(ImageStack[i].Image->Images, 0, DragOffsetX, DragOffsetY); - ImageList_SetDragCursorImage(ImageStack[i].Image->Images, 0, 0, 0); - ImageList_DragEnter(AdvancedWorkspace, x, y); - - // ImageStack[i].x = -200; - // ImageStack[i].y = -200; - // InvalidateRect(AdvancedWorkspace, &TempRect, TRUE); - DragIndex = i; - Dragging = TRUE; - return 0; - } - } - // HBITMAP temp=(HBITMAP)GetCurrentObject(GetDC(AdvancedWorkspace), OBJ_BITMAP); - // if(temp == NULL) + // int i; + // for(i = 0; i < ImagesDrawn; i++) // { - // MessageBox(ComponentList, "Bitmap Found", "Information", MB_OK | MB_ICONEXCLAMATION); + // if((((ImageStack[i].x + COMPONENT_WIDTH) > x) && (ImageStack[i].x < x) + // && (ImageStack[i].y < y) && ((ImageStack[i].y + COMPONENT_HEIGHT) > y))) + // { + // // RECT TempRect; + // // TempRect.left = ImageStack[i].x; + // // TempRect.top = ImageStack[i].y; + // // TempRect.right = ImageStack[i].x + 100; + // // TempRect.bottom = ImageStack[i].y + 100; + + // DragOffsetX = x - ImageStack[i].x; + // DragOffsetY = y - ImageStack[i].y; + // DragX = x; + // DragY = y; + + // // MessageBox(ComponentList, "Clicked Image", "Error", MB_OK | MB_ICONEXCLAMATION); + // ImageList_BeginDrag(ImageStack[i].Image->Images, 0, DragOffsetX, DragOffsetY); + // ImageList_SetDragCursorImage(ImageStack[i].Image->Images, 0, 0, 0); + // ImageList_DragEnter(AdvancedWorkspace, x, y); + + // // ImageStack[i].x = -200; + // // ImageStack[i].y = -200; + // // InvalidateRect(AdvancedWorkspace, &TempRect, TRUE); + // DragIndex = i; + // Dragging = TRUE; + // return 0; + // } // } - return 0; + // // HBITMAP temp=(HBITMAP)GetCurrentObject(GetDC(AdvancedWorkspace), OBJ_BITMAP); + // // if(temp == NULL) + // // { + // // MessageBox(ComponentList, "Bitmap Found", "Information", MB_OK | MB_ICONEXCLAMATION); + // // } + // return 0; } int ComponentDrag(int x, int y) { - if(Dragging) - { - ImageList_DragMove(x, y); - // ImageStack[DragIndex].x = x - DragOffsetX; - // ImageStack[DragIndex].y = y - DragOffsetY; - // InvalidateRect(AdvancedWorkspace, NULL, TRUE); - } - else - { - SetCursor(LoadCursor(NULL, IDC_ARROW)); - } - return 0; + // if(Dragging) + // { + // ImageList_DragMove(x, y); + // // ImageStack[DragIndex].x = x - DragOffsetX; + // // ImageStack[DragIndex].y = y - DragOffsetY; + // // InvalidateRect(AdvancedWorkspace, NULL, TRUE); + // } + // else + // { + // SetCursor(LoadCursor(NULL, IDC_ARROW)); + // } + // return 0; } int EndComponentDrag(int x, int y) { - if(Dragging) - { - // HBITMAP TempBM; - // HDC HdcMem2 = GetDC(AdvancedWorkspace); - // HDC HdcMem =GetDC(AdvancedWorkspace); - // RECT TempRect; - // GetWindowRect(AdvancedWorkspace, &TempRect); - ImageList_DragLeave(AdvancedWorkspace); - ImageList_EndDrag(); - ImageStack[DragIndex].x = x - DragOffsetX; - ImageStack[DragIndex].y = y - DragOffsetY; - // InvalidateRect(AdvancedWorkspace, &TempRect, TRUE); - InvalidateRect(AdvancedWorkspace, NULL, TRUE); - // TempBM = CreateBitmap(COMPONENT_WIDTH, COMPONENT_HEIGHT, 1, 32, NULL); - - // BitBlt(HdcMem2, x, y, COMPONENT_WIDTH, COMPONENT_HEIGHT, HdcMem, 100, 100, SRCERASE); - Dragging =FALSE; - return DragIndex; - } - // IMAGEINFO imginfo; - // ImageList_GetImageInfo(ComponentDiagrams,0, &imginfo); - // char vx[4],vy[4]; - // itoa(imginfo.rcImage.right,vx,10); - // itoa(imginfo.rcImage.bottom,vy,10); - // MessageBox(ComponentList, _(vx), _(vy), MB_OK | MB_ICONEXCLAMATION); - // imginfo.rcImage.left=x; - // imginfo.rcImage.top=y; - // ImageList_Draw(ComponentDiagrams, 0, GetDC(AdvancedWorkspace), x, y, ILD_TRANSPARENT); - return NULL; + // if(Dragging) + // { + // // HBITMAP TempBM; + // // HDC HdcMem2 = GetDC(AdvancedWorkspace); + // // HDC HdcMem =GetDC(AdvancedWorkspace); + // // RECT TempRect; + // // GetWindowRect(AdvancedWorkspace, &TempRect); + // ImageList_DragLeave(AdvancedWorkspace); + // ImageList_EndDrag(); + // ImageStack[DragIndex].x = x - DragOffsetX; + // ImageStack[DragIndex].y = y - DragOffsetY; + // // InvalidateRect(AdvancedWorkspace, &TempRect, TRUE); + // InvalidateRect(AdvancedWorkspace, NULL, TRUE); + // // TempBM = CreateBitmap(COMPONENT_WIDTH, COMPONENT_HEIGHT, 1, 32, NULL); + + // // BitBlt(HdcMem2, x, y, COMPONENT_WIDTH, COMPONENT_HEIGHT, HdcMem, 100, 100, SRCERASE); + // Dragging =FALSE; + // return DragIndex; + // } + // // IMAGEINFO imginfo; + // // ImageList_GetImageInfo(ComponentDiagrams,0, &imginfo); + // // char vx[4],vy[4]; + // // itoa(imginfo.rcImage.right,vx,10); + // // itoa(imginfo.rcImage.bottom,vy,10); + // // MessageBox(ComponentList, _(vx), _(vy), MB_OK | MB_ICONEXCLAMATION); + // // imginfo.rcImage.left=x; + // // imginfo.rcImage.top=y; + // // ImageList_Draw(ComponentDiagrams, 0, GetDC(AdvancedWorkspace), x, y, ILD_TRANSPARENT); + // return NULL; } diff --git a/ldmicro/confdialog.cpp b/ldmicro/confdialog.cpp index 3967fc7..1b77fd0 100644 --- a/ldmicro/confdialog.cpp +++ b/ldmicro/confdialog.cpp @@ -22,18 +22,18 @@ // which is configurable, plus the MCU clock (i.e. crystal frequency). // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> #include <stdlib.h> -#include <commctrl.h> +//#include <commctrl.h> #include "ldmicro.h" -static HWND ConfDialog; +// static HWND ConfDialog; -static HWND CrystalTextbox; -static HWND CycleTextbox; -static HWND BaudTextbox; +// static HWND CrystalTextbox; +// static HWND CycleTextbox; +// static HWND BaudTextbox; static LONG_PTR PrevCrystalProc; static LONG_PTR PrevCycleProc; @@ -42,208 +42,208 @@ static LONG_PTR PrevBaudProc; //----------------------------------------------------------------------------- // Don't allow any characters other than 0-9. in the text boxes. //----------------------------------------------------------------------------- -static LRESULT CALLBACK MyNumberProc(HWND hwnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - if(msg == WM_CHAR) { - if(!(isdigit(wParam) || wParam == '.' || wParam == '\b')) { - return 0; - } - } - - LONG_PTR t; - if(hwnd == CrystalTextbox) - t = PrevCrystalProc; - else if(hwnd == CycleTextbox) - t = PrevCycleProc; - else if(hwnd == BaudTextbox) - t = PrevBaudProc; - else - oops(); - - return CallWindowProc((WNDPROC)t, hwnd, msg, wParam, lParam); -} - -static void MakeControls(void) -{ - HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Cycle Time (ms):"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, - 5, 13, 145, 21, ConfDialog, NULL, Instance, NULL); - NiceFont(textLabel); - - CycleTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 155, 12, 85, 21, ConfDialog, NULL, Instance, NULL); - NiceFont(CycleTextbox); - - HWND textLabel2 = CreateWindowEx(0, WC_STATIC, - _("Crystal Frequency (MHz):"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, - 0, 43, 150, 21, ConfDialog, NULL, Instance, NULL); - NiceFont(textLabel2); - - CrystalTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 155, 42, 85, 21, ConfDialog, NULL, Instance, NULL); - NiceFont(CrystalTextbox); - - HWND textLabel3 = CreateWindowEx(0, WC_STATIC, _("UART Baud Rate (bps):"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, - 5, 73, 145, 21, ConfDialog, NULL, Instance, NULL); - NiceFont(textLabel3); - - BaudTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 155, 72, 85, 21, ConfDialog, NULL, Instance, NULL); - NiceFont(BaudTextbox); - - if(!UartFunctionUsed()) { - EnableWindow(BaudTextbox, FALSE); - EnableWindow(textLabel3, FALSE); - } - - if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || - Prog.mcu->whichIsa == ISA_INTERPRETED)) - { - EnableWindow(CrystalTextbox, FALSE); - EnableWindow(textLabel2, FALSE); - } - - OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, - 258, 11, 70, 23, ConfDialog, NULL, Instance, NULL); - NiceFont(OkButton); - - CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 258, 41, 70, 23, ConfDialog, NULL, Instance, NULL); - NiceFont(CancelButton); - - char explanation[1024] = ""; - - if(UartFunctionUsed()) { - if(Prog.mcu && Prog.mcu->uartNeeds.rxPin != 0) { - sprintf(explanation, - _("Serial (UART) will use pins %d and %d.\r\n\r\n"), - Prog.mcu->uartNeeds.rxPin, Prog.mcu->uartNeeds.txPin); - } else { - strcpy(explanation, - _("Please select a micro with a UART.\r\n\r\n")); - } - } else { - strcpy(explanation, _("No serial instructions (UART Send/UART Receive) " - "are in use; add one to program before setting baud rate.\r\n\r\n") - ); - } - - strcat(explanation, - _("The cycle time for the 'PLC' runtime generated by LDmicro is user-" - "configurable. Very short cycle times may not be achievable due " - "to processor speed constraints, and very long cycle times may not " - "be achievable due to hardware overflows. Cycle times between 10 ms " - "and 100 ms will usually be practical.\r\n\r\n" - "The compiler must know what speed crystal you are using with the " - "micro to convert between timing in clock cycles and timing in " - "seconds. A 4 MHz to 20 MHz crystal is typical; check the speed " - "grade of the part you are using to determine the maximum allowable " - "clock speed before choosing a crystal.")); - - HWND textLabel4 = CreateWindowEx(0, WC_STATIC, explanation, - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, - 11, 104, 310, 400, ConfDialog, NULL, Instance, NULL); - NiceFont(textLabel4); - - // Measure the explanation string, so that we know how to size our window - RECT tr, cr; - HDC hdc = CreateCompatibleDC(NULL); - SelectObject(hdc, MyNiceFont); - SetRect(&tr, 0, 0, 310, 400); - DrawText(hdc, explanation, -1, &tr, DT_CALCRECT | - DT_LEFT | DT_TOP | DT_WORDBREAK); - DeleteDC(hdc); - int h = 104 + tr.bottom + 10; - SetWindowPos(ConfDialog, NULL, 0, 0, 344, h, SWP_NOMOVE); - // h is the desired client height, but SetWindowPos includes title bar; - // so fix it up by hand - GetClientRect(ConfDialog, &cr); - int nh = h + (h - (cr.bottom - cr.top)); - SetWindowPos(ConfDialog, NULL, 0, 0, 344, nh, SWP_NOMOVE); - - - PrevCycleProc = SetWindowLongPtr(CycleTextbox, GWLP_WNDPROC, - (LONG_PTR)MyNumberProc); - - PrevCrystalProc = SetWindowLongPtr(CrystalTextbox, GWLP_WNDPROC, - (LONG_PTR)MyNumberProc); - - PrevBaudProc = SetWindowLongPtr(BaudTextbox, GWLP_WNDPROC, - (LONG_PTR)MyNumberProc); -} - -void ShowConfDialog(void) -{ - // The window's height will be resized later, to fit the explanation text. - ConfDialog = CreateWindowClient(0, "LDmicroDialog", _("PLC Configuration"), - WS_OVERLAPPED | WS_SYSMENU, - 100, 100, 0, 0, NULL, NULL, Instance, NULL); - - MakeControls(); +// static LRESULT CALLBACK MyNumberProc(HWND hwnd, UINT msg, WPARAM wParam, +// LPARAM lParam) +// { +// if(msg == WM_CHAR) { +// if(!(isdigit(wParam) || wParam == '.' || wParam == '\b')) { +// return 0; +// } +// } + +// LONG_PTR t; +// if(hwnd == CrystalTextbox) +// t = PrevCrystalProc; +// else if(hwnd == CycleTextbox) +// t = PrevCycleProc; +// else if(hwnd == BaudTextbox) +// t = PrevBaudProc; +// else +// oops(); + +// return CallWindowProc((WNDPROC)t, hwnd, msg, wParam, lParam); +// } + +// static void MakeControls(void) +// { +// HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Cycle Time (ms):"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, +// 5, 13, 145, 21, ConfDialog, NULL, Instance, NULL); +// NiceFont(textLabel); + +// CycleTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 155, 12, 85, 21, ConfDialog, NULL, Instance, NULL); +// NiceFont(CycleTextbox); + +// HWND textLabel2 = CreateWindowEx(0, WC_STATIC, +// _("Crystal Frequency (MHz):"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, +// 0, 43, 150, 21, ConfDialog, NULL, Instance, NULL); +// NiceFont(textLabel2); + +// CrystalTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 155, 42, 85, 21, ConfDialog, NULL, Instance, NULL); +// NiceFont(CrystalTextbox); + +// HWND textLabel3 = CreateWindowEx(0, WC_STATIC, _("UART Baud Rate (bps):"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, +// 5, 73, 145, 21, ConfDialog, NULL, Instance, NULL); +// NiceFont(textLabel3); + +// BaudTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 155, 72, 85, 21, ConfDialog, NULL, Instance, NULL); +// NiceFont(BaudTextbox); + +// if(!UartFunctionUsed()) { +// EnableWindow(BaudTextbox, FALSE); +// EnableWindow(textLabel3, FALSE); +// } + +// if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || +// Prog.mcu->whichIsa == ISA_INTERPRETED)) +// { +// EnableWindow(CrystalTextbox, FALSE); +// EnableWindow(textLabel2, FALSE); +// } + +// OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, +// 258, 11, 70, 23, ConfDialog, NULL, Instance, NULL); +// NiceFont(OkButton); + +// CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 258, 41, 70, 23, ConfDialog, NULL, Instance, NULL); +// NiceFont(CancelButton); + +// char explanation[1024] = ""; + +// if(UartFunctionUsed()) { +// if(Prog.mcu && Prog.mcu->uartNeeds.rxPin != 0) { +// sprintf(explanation, +// _("Serial (UART) will use pins %d and %d.\r\n\r\n"), +// Prog.mcu->uartNeeds.rxPin, Prog.mcu->uartNeeds.txPin); +// } else { +// strcpy(explanation, +// _("Please select a micro with a UART.\r\n\r\n")); +// } +// } else { +// strcpy(explanation, _("No serial instructions (UART Send/UART Receive) " +// "are in use; add one to program before setting baud rate.\r\n\r\n") +// ); +// } + +// strcat(explanation, +// _("The cycle time for the 'PLC' runtime generated by LDmicro is user-" +// "configurable. Very short cycle times may not be achievable due " +// "to processor speed constraints, and very long cycle times may not " +// "be achievable due to hardware overflows. Cycle times between 10 ms " +// "and 100 ms will usually be practical.\r\n\r\n" +// "The compiler must know what speed crystal you are using with the " +// "micro to convert between timing in clock cycles and timing in " +// "seconds. A 4 MHz to 20 MHz crystal is typical; check the speed " +// "grade of the part you are using to determine the maximum allowable " +// "clock speed before choosing a crystal.")); + +// HWND textLabel4 = CreateWindowEx(0, WC_STATIC, explanation, +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, +// 11, 104, 310, 400, ConfDialog, NULL, Instance, NULL); +// NiceFont(textLabel4); + +// // Measure the explanation string, so that we know how to size our window +// RECT tr, cr; +// HDC hdc = CreateCompatibleDC(NULL); +// SelectObject(hdc, MyNiceFont); +// SetRect(&tr, 0, 0, 310, 400); +// DrawText(hdc, explanation, -1, &tr, DT_CALCRECT | +// DT_LEFT | DT_TOP | DT_WORDBREAK); +// DeleteDC(hdc); +// int h = 104 + tr.bottom + 10; +// SetWindowPos(ConfDialog, NULL, 0, 0, 344, h, SWP_NOMOVE); +// // h is the desired client height, but SetWindowPos includes title bar; +// // so fix it up by hand +// GetClientRect(ConfDialog, &cr); +// int nh = h + (h - (cr.bottom - cr.top)); +// SetWindowPos(ConfDialog, NULL, 0, 0, 344, nh, SWP_NOMOVE); + + +// PrevCycleProc = SetWindowLongPtr(CycleTextbox, GWLP_WNDPROC, +// (LONG_PTR)MyNumberProc); + +// PrevCrystalProc = SetWindowLongPtr(CrystalTextbox, GWLP_WNDPROC, +// (LONG_PTR)MyNumberProc); + +// PrevBaudProc = SetWindowLongPtr(BaudTextbox, GWLP_WNDPROC, +// (LONG_PTR)MyNumberProc); +// } + +// void ShowConfDialog(void) +// { +// // The window's height will be resized later, to fit the explanation text. +// ConfDialog = CreateWindowClient(0, "LDmicroDialog", _("PLC Configuration"), +// WS_OVERLAPPED | WS_SYSMENU, +// 100, 100, 0, 0, NULL, NULL, Instance, NULL); + +// MakeControls(); - char buf[16]; - sprintf(buf, "%.1f", (Prog.cycleTime / 1000.0)); - SendMessage(CycleTextbox, WM_SETTEXT, 0, (LPARAM)buf); - - sprintf(buf, "%.6f", Prog.mcuClock / 1e6); - SendMessage(CrystalTextbox, WM_SETTEXT, 0, (LPARAM)buf); - - sprintf(buf, "%d", Prog.baudRate); - SendMessage(BaudTextbox, WM_SETTEXT, 0, (LPARAM)buf); - - EnableWindow(MainWindow, FALSE); - ShowWindow(ConfDialog, TRUE); - SetFocus(CycleTextbox); - - MSG msg; - DWORD ret; - DialogDone = FALSE; - DialogCancel = FALSE; - while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { - if(msg.message == WM_KEYDOWN) { - if(msg.wParam == VK_RETURN) { - DialogDone = TRUE; - break; - } else if(msg.wParam == VK_ESCAPE) { - DialogDone = TRUE; - DialogCancel = TRUE; - break; - } - } - - if(IsDialogMessage(ConfDialog, &msg)) continue; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if(!DialogCancel) { - char buf[16]; - SendMessage(CycleTextbox, WM_GETTEXT, (WPARAM)sizeof(buf), - (LPARAM)(buf)); - Prog.cycleTime = (int)(1000*atof(buf) + 0.5); - if(Prog.cycleTime == 0) { - Error(_("Zero cycle time not valid; resetting to 10 ms.")); - Prog.cycleTime = 10000; - } - - SendMessage(CrystalTextbox, WM_GETTEXT, (WPARAM)sizeof(buf), - (LPARAM)(buf)); - Prog.mcuClock = (int)(1e6*atof(buf) + 0.5); - - SendMessage(BaudTextbox, WM_GETTEXT, (WPARAM)sizeof(buf), - (LPARAM)(buf)); - Prog.baudRate = atoi(buf); - } - - EnableWindow(MainWindow, TRUE); - DestroyWindow(ConfDialog); - return; -} +// char buf[16]; +// sprintf(buf, "%.1f", (Prog.cycleTime / 1000.0)); +// SendMessage(CycleTextbox, WM_SETTEXT, 0, (LPARAM)buf); + +// sprintf(buf, "%.6f", Prog.mcuClock / 1e6); +// SendMessage(CrystalTextbox, WM_SETTEXT, 0, (LPARAM)buf); + +// sprintf(buf, "%d", Prog.baudRate); +// SendMessage(BaudTextbox, WM_SETTEXT, 0, (LPARAM)buf); + +// EnableWindow(MainWindow, FALSE); +// ShowWindow(ConfDialog, TRUE); +// SetFocus(CycleTextbox); + +// MSG msg; +// DWORD ret; +// DialogDone = FALSE; +// DialogCancel = FALSE; +// while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { +// if(msg.message == WM_KEYDOWN) { +// if(msg.wParam == VK_RETURN) { +// DialogDone = TRUE; +// break; +// } else if(msg.wParam == VK_ESCAPE) { +// DialogDone = TRUE; +// DialogCancel = TRUE; +// break; +// } +// } + +// if(IsDialogMessage(ConfDialog, &msg)) continue; +// TranslateMessage(&msg); +// DispatchMessage(&msg); +// } + +// if(!DialogCancel) { +// char buf[16]; +// SendMessage(CycleTextbox, WM_GETTEXT, (WPARAM)sizeof(buf), +// (LPARAM)(buf)); +// Prog.cycleTime = (int)(1000*atof(buf) + 0.5); +// if(Prog.cycleTime == 0) { +// Error(_("Zero cycle time not valid; resetting to 10 ms.")); +// Prog.cycleTime = 10000; +// } + +// SendMessage(CrystalTextbox, WM_GETTEXT, (WPARAM)sizeof(buf), +// (LPARAM)(buf)); +// Prog.mcuClock = (int)(1e6*atof(buf) + 0.5); + +// SendMessage(BaudTextbox, WM_GETTEXT, (WPARAM)sizeof(buf), +// (LPARAM)(buf)); +// Prog.baudRate = atoi(buf); +// } + +// EnableWindow(MainWindow, TRUE); +// DestroyWindow(ConfDialog); +// return; +// } diff --git a/ldmicro/contactsdialog.cpp b/ldmicro/contactsdialog.cpp index a6788fc..fe2922c 100644 --- a/ldmicro/contactsdialog.cpp +++ b/ldmicro/contactsdialog.cpp @@ -21,9 +21,9 @@ // plus the name // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include <linuxUI.h> #include <stdio.h> -#include <commctrl.h> +//#include <commctrl.h> #include "ldmicro.h" diff --git a/ldmicro/draw.cpp b/ldmicro/draw.cpp index 83ab7b3..75fcf54 100644 --- a/ldmicro/draw.cpp +++ b/ldmicro/draw.cpp @@ -23,7 +23,7 @@ // with wires. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> diff --git a/ldmicro/draw_outputdev.cpp b/ldmicro/draw_outputdev.cpp index 0d6f3cd..5b05db5 100644 --- a/ldmicro/draw_outputdev.cpp +++ b/ldmicro/draw_outputdev.cpp @@ -83,26 +83,26 @@ SyntaxHighlightingColours HighlightColours; //----------------------------------------------------------------------------- void CALLBACK BlinkCursor(HWND hwnd, UINT msg, UINT_PTR id, DWORD time) { - if(!isFocus(MainWindow) && !CursorDrawn) return; - if(Cursor.left == 0) return; + // if(!isFocus(MainWindow) && !CursorDrawn) return; + // if(Cursor.left == 0) return; - PlcCursor c; - memcpy(&c, &Cursor, sizeof(c)); + // PlcCursor c; + // memcpy(&c, &Cursor, sizeof(c)); - c.top -= ScrollYOffset*POS_HEIGHT*FONT_HEIGHT; - c.left -= ScrollXOffset; + // c.top -= ScrollYOffset*POS_HEIGHT*FONT_HEIGHT; + // c.left -= ScrollXOffset; - if(c.top >= IoListTop) return; + // if(c.top >= IoListTop) return; - if(c.top + c.height >= IoListTop) { - c.height = IoListTop - c.top - 3; - } + // if(c.top + c.height >= IoListTop) { + // c.height = IoListTop - c.top - 3; + // } - Hdc = GetDC(MainWindow); - SelectObject(Hdc, GetStockObject(WHITE_BRUSH)); - PatBlt(Hdc, c.left, c.top, c.width, c.height, PATINVERT); - CursorDrawn = !CursorDrawn; - ReleaseDC(MainWindow, Hdc); + // Hdc = GetDC(MainWindow); + // SelectObject(Hdc, GetStockObject(WHITE_BRUSH)); + // PatBlt(Hdc, c.left, c.top, c.width, c.height, PATINVERT); + // CursorDrawn = !CursorDrawn; + // ReleaseDC(MainWindow, Hdc); } //----------------------------------------------------------------------------- @@ -111,77 +111,77 @@ void CALLBACK BlinkCursor(HWND hwnd, UINT msg, UINT_PTR id, DWORD time) //----------------------------------------------------------------------------- static void DrawCharsToScreen(int cx, int cy, char *str) { - cy -= ScrollYOffset*POS_HEIGHT; - if(cy < -2) return; - if(cy*FONT_HEIGHT + Y_PADDING > IoListTop) return; - - COLORREF prev; - BOOL firstTime = TRUE; - BOOL inNumber = FALSE; - BOOL inComment = FALSE; - int inBrace = 0; - for(; *str; str++, cx++) { - int x = cx*FONT_WIDTH + X_PADDING; - int y = cy*FONT_HEIGHT + Y_PADDING; - - BOOL hiOk = !(InSimulationMode || ThisHighlighted); - - if(strchr("{}[]", *str) && hiOk && !inComment) { - if(*str == '{' || *str == '[') inBrace++; - if(inBrace == 1) { - prev = GetTextColor(Hdc); - SetTextColor(Hdc, HighlightColours.punct); - TextOut(Hdc, x, y, str, 1); - SetTextColor(Hdc, prev); - } else { - TextOut(Hdc, x, y, str, 1); - } - if(*str == ']' || *str == '}') inBrace--; - } else if(( - (isdigit(*str) && (firstTime || isspace(str[-1]) - || str[-1] == ':' || str[-1] == '[')) || - (*str == '-' && isdigit(str[1]))) && hiOk && !inComment) - { - prev = GetTextColor(Hdc); - SetTextColor(Hdc, HighlightColours.lit); - TextOut(Hdc, x, y, str, 1); - SetTextColor(Hdc, prev); - inNumber = TRUE; - } else if(*str == '\x01') { - cx--; - if(hiOk) { - prev = GetTextColor(Hdc); - SetTextColor(Hdc, HighlightColours.op); - } - } else if(*str == '\x02') { - cx--; - if(hiOk) { - SetTextColor(Hdc, prev); - inComment = FALSE; - } - } else if(*str == '\x03') { - cx--; - if(hiOk) { - prev = GetTextColor(Hdc); - SetTextColor(Hdc, HighlightColours.comment); - inComment = TRUE; - } - } else if(inNumber) { - if(isdigit(*str) || *str == '.') { - prev = GetTextColor(Hdc); - SetTextColor(Hdc, HighlightColours.lit); - TextOut(Hdc, x, y, str, 1); - SetTextColor(Hdc, prev); - } else { - TextOut(Hdc, x, y, str, 1); - inNumber = FALSE; - } - } else { - TextOut(Hdc, x, y, str, 1); - } - - firstTime = FALSE; - } + // cy -= ScrollYOffset*POS_HEIGHT; + // if(cy < -2) return; + // if(cy*FONT_HEIGHT + Y_PADDING > IoListTop) return; + + // COLORREF prev; + // BOOL firstTime = TRUE; + // BOOL inNumber = FALSE; + // BOOL inComment = FALSE; + // int inBrace = 0; + // for(; *str; str++, cx++) { + // int x = cx*FONT_WIDTH + X_PADDING; + // int y = cy*FONT_HEIGHT + Y_PADDING; + + // BOOL hiOk = !(InSimulationMode || ThisHighlighted); + + // if(strchr("{}[]", *str) && hiOk && !inComment) { + // if(*str == '{' || *str == '[') inBrace++; + // if(inBrace == 1) { + // prev = GetTextColor(Hdc); + // SetTextColor(Hdc, HighlightColours.punct); + // TextOut(Hdc, x, y, str, 1); + // SetTextColor(Hdc, prev); + // } else { + // TextOut(Hdc, x, y, str, 1); + // } + // if(*str == ']' || *str == '}') inBrace--; + // } else if(( + // (isdigit(*str) && (firstTime || isspace(str[-1]) + // || str[-1] == ':' || str[-1] == '[')) || + // (*str == '-' && isdigit(str[1]))) && hiOk && !inComment) + // { + // prev = GetTextColor(Hdc); + // SetTextColor(Hdc, HighlightColours.lit); + // TextOut(Hdc, x, y, str, 1); + // SetTextColor(Hdc, prev); + // inNumber = TRUE; + // } else if(*str == '\x01') { + // cx--; + // if(hiOk) { + // prev = GetTextColor(Hdc); + // SetTextColor(Hdc, HighlightColours.op); + // } + // } else if(*str == '\x02') { + // cx--; + // if(hiOk) { + // SetTextColor(Hdc, prev); + // inComment = FALSE; + // } + // } else if(*str == '\x03') { + // cx--; + // if(hiOk) { + // prev = GetTextColor(Hdc); + // SetTextColor(Hdc, HighlightColours.comment); + // inComment = TRUE; + // } + // } else if(inNumber) { + // if(isdigit(*str) || *str == '.') { + // prev = GetTextColor(Hdc); + // SetTextColor(Hdc, HighlightColours.lit); + // TextOut(Hdc, x, y, str, 1); + // SetTextColor(Hdc, prev); + // } else { + // TextOut(Hdc, x, y, str, 1); + // inNumber = FALSE; + // } + // } else { + // TextOut(Hdc, x, y, str, 1); + // } + + // firstTime = FALSE; + // } } //----------------------------------------------------------------------------- @@ -191,10 +191,10 @@ static void DrawCharsToScreen(int cx, int cy, char *str) //----------------------------------------------------------------------------- int ScreenColsAvailable(void) { - RECT r; - GetClientRect(MainWindow, &r); + // RECT r; + // GetClientRect(MainWindow, &r); - return (r.right - (X_PADDING + X_RIGHT_PADDING)) / (POS_WIDTH*FONT_WIDTH); + // return (r.right - (X_PADDING + X_RIGHT_PADDING)) / (POS_WIDTH*FONT_WIDTH); } //----------------------------------------------------------------------------- @@ -205,13 +205,13 @@ int ScreenColsAvailable(void) //----------------------------------------------------------------------------- int ScreenRowsAvailable(void) { - int adj; - if(ScrollXOffsetMax == 0) { - adj = 0; - } else { - adj = 18; - } - return (IoListTop - Y_PADDING - adj) / (POS_HEIGHT*FONT_HEIGHT); + // int adj; + // if(ScrollXOffsetMax == 0) { + // adj = 0; + // } else { + // adj = 18; + // } + // return (IoListTop - Y_PADDING - adj) / (POS_HEIGHT*FONT_HEIGHT); } //----------------------------------------------------------------------------- @@ -221,134 +221,134 @@ int ScreenRowsAvailable(void) //----------------------------------------------------------------------------- void PaintWindow(void) { - static HBITMAP BackBitmap; - static HDC BackDc; - static int BitmapWidth; - - ok(); - - RECT r; - GetClientRect(MainWindow, &r); - int bw = r.right; - int bh = IoListTop; - - HDC paintDc; - if(!BackDc) { - HWND desktop = GetDesktopWindow(); - RECT dk; - GetClientRect(desktop, &dk); - - BitmapWidth = max(2000, dk.right + 300); - BackBitmap = CreateCompatibleBitmap(Hdc, BitmapWidth, dk.bottom + 300); - BackDc = CreateCompatibleDC(Hdc); - SelectObject(BackDc, BackBitmap); - } - paintDc = Hdc; - Hdc = BackDc; - - RECT fi; - fi.left = 0; fi.top = 0; - fi.right = BitmapWidth; fi.bottom = bh; - FillRect(Hdc, &fi, InSimulationMode ? SimBgBrush : BgBrush); + // static HBITMAP BackBitmap; + // static HDC BackDc; + // static int BitmapWidth; + + // ok(); + + // RECT r; + // GetClientRect(MainWindow, &r); + // int bw = r.right; + // int bh = IoListTop; + + // HDC paintDc; + // if(!BackDc) { + // HWND desktop = GetDesktopWindow(); + // RECT dk; + // GetClientRect(desktop, &dk); + + // BitmapWidth = max(2000, dk.right + 300); + // BackBitmap = CreateCompatibleBitmap(Hdc, BitmapWidth, dk.bottom + 300); + // BackDc = CreateCompatibleDC(Hdc); + // SelectObject(BackDc, BackBitmap); + // } + // paintDc = Hdc; + // Hdc = BackDc; + + // RECT fi; + // fi.left = 0; fi.top = 0; + // fi.right = BitmapWidth; fi.bottom = bh; + // FillRect(Hdc, &fi, InSimulationMode ? SimBgBrush : BgBrush); - // now figure out how we should draw the ladder logic - ColsAvailable = ProgCountWidestRow(); - if(ColsAvailable < ScreenColsAvailable()) { - ColsAvailable = ScreenColsAvailable(); - } - memset(DisplayMatrix, 0, sizeof(DisplayMatrix)); - SelectionActive = FALSE; - memset(&Cursor, 0, sizeof(Cursor)); - - DrawChars = DrawCharsToScreen; - - int i; - int cy = 0; - int rowsAvailable = ScreenRowsAvailable(); - for(i = 0; i < Prog.numRungs; i++) { - int thisHeight = POS_HEIGHT*CountHeightOfElement(ELEM_SERIES_SUBCKT, - Prog.rungs[i]); - - // For speed, there is no need to draw everything all the time, but - // we still must draw a bit above and below so that the DisplayMatrix - // is filled in enough to make it possible to reselect using the - // cursor keys. - if(((cy + thisHeight) >= (ScrollYOffset - 8)*POS_HEIGHT) && - (cy < (ScrollYOffset + rowsAvailable + 8)*POS_HEIGHT)) - { - SetBkColor(Hdc, InSimulationMode ? HighlightColours.simBg : - HighlightColours.bg); - SetTextColor(Hdc, InSimulationMode ? HighlightColours.simRungNum : - HighlightColours.rungNum); - SelectObject(Hdc, FixedWidthFont); - int rung = i + 1; - int y = Y_PADDING + FONT_HEIGHT*cy; - int yp = y + FONT_HEIGHT*(POS_HEIGHT/2) - - POS_HEIGHT*FONT_HEIGHT*ScrollYOffset; - - if(rung < 10) { - char r[1] = { rung + '0' }; - TextOut(Hdc, 8 + FONT_WIDTH, yp, r, 1); - } else { - char r[2] = { (rung / 10) + '0', (rung % 10) + '0' }; - TextOut(Hdc, 8, yp, r, 2); - } - - int cx = 0; - DrawElement(ELEM_SERIES_SUBCKT, Prog.rungs[i], &cx, &cy, - Prog.rungPowered[i]); - } - - cy += thisHeight; - cy += POS_HEIGHT; - } - cy -= 2; - DrawEndRung(0, cy); - - if(SelectedGxAfterNextPaint >= 0) { - MoveCursorNear(SelectedGxAfterNextPaint, SelectedGyAfterNextPaint); - InvalidateRect(MainWindow, NULL, FALSE); - SelectedGxAfterNextPaint = -1; - SelectedGyAfterNextPaint = -1; - } else if(ScrollSelectedIntoViewAfterNextPaint && Selected) { - SelectElement(-1, -1, Selected->selectedState); - ScrollSelectedIntoViewAfterNextPaint = FALSE; - InvalidateRect(MainWindow, NULL, FALSE); - } else { - if(!SelectionActive) { - if(Prog.numRungs > 0) { - if(MoveCursorTopLeft()) { - InvalidateRect(MainWindow, NULL, FALSE); - } - } - } - } - - // draw the `buses' at either side of the screen - r.left = X_PADDING - FONT_WIDTH; - r.top = 0; - r.right = r.left + 4; - r.bottom = IoListTop; - FillRect(Hdc, &r, InSimulationMode ? BusLeftBrush : BusBrush); - - r.left += POS_WIDTH*FONT_WIDTH*ColsAvailable + 2; - r.right += POS_WIDTH*FONT_WIDTH*ColsAvailable + 2; - FillRect(Hdc, &r, InSimulationMode ? BusRightBus : BusBrush); + // // now figure out how we should draw the ladder logic + // ColsAvailable = ProgCountWidestRow(); + // if(ColsAvailable < ScreenColsAvailable()) { + // ColsAvailable = ScreenColsAvailable(); + // } + // memset(DisplayMatrix, 0, sizeof(DisplayMatrix)); + // SelectionActive = FALSE; + // memset(&Cursor, 0, sizeof(Cursor)); + + // DrawChars = DrawCharsToScreen; + + // int i; + // int cy = 0; + // int rowsAvailable = ScreenRowsAvailable(); + // for(i = 0; i < Prog.numRungs; i++) { + // int thisHeight = POS_HEIGHT*CountHeightOfElement(ELEM_SERIES_SUBCKT, + // Prog.rungs[i]); + + // // For speed, there is no need to draw everything all the time, but + // // we still must draw a bit above and below so that the DisplayMatrix + // // is filled in enough to make it possible to reselect using the + // // cursor keys. + // if(((cy + thisHeight) >= (ScrollYOffset - 8)*POS_HEIGHT) && + // (cy < (ScrollYOffset + rowsAvailable + 8)*POS_HEIGHT)) + // { + // SetBkColor(Hdc, InSimulationMode ? HighlightColours.simBg : + // HighlightColours.bg); + // SetTextColor(Hdc, InSimulationMode ? HighlightColours.simRungNum : + // HighlightColours.rungNum); + // SelectObject(Hdc, FixedWidthFont); + // int rung = i + 1; + // int y = Y_PADDING + FONT_HEIGHT*cy; + // int yp = y + FONT_HEIGHT*(POS_HEIGHT/2) - + // POS_HEIGHT*FONT_HEIGHT*ScrollYOffset; + + // if(rung < 10) { + // char r[1] = { rung + '0' }; + // TextOut(Hdc, 8 + FONT_WIDTH, yp, r, 1); + // } else { + // char r[2] = { (rung / 10) + '0', (rung % 10) + '0' }; + // TextOut(Hdc, 8, yp, r, 2); + // } + + // int cx = 0; + // DrawElement(ELEM_SERIES_SUBCKT, Prog.rungs[i], &cx, &cy, + // Prog.rungPowered[i]); + // } + + // cy += thisHeight; + // cy += POS_HEIGHT; + // } + // cy -= 2; + // DrawEndRung(0, cy); + + // if(SelectedGxAfterNextPaint >= 0) { + // MoveCursorNear(SelectedGxAfterNextPaint, SelectedGyAfterNextPaint); + // InvalidateRect(MainWindow, NULL, FALSE); + // SelectedGxAfterNextPaint = -1; + // SelectedGyAfterNextPaint = -1; + // } else if(ScrollSelectedIntoViewAfterNextPaint && Selected) { + // SelectElement(-1, -1, Selected->selectedState); + // ScrollSelectedIntoViewAfterNextPaint = FALSE; + // InvalidateRect(MainWindow, NULL, FALSE); + // } else { + // if(!SelectionActive) { + // if(Prog.numRungs > 0) { + // if(MoveCursorTopLeft()) { + // InvalidateRect(MainWindow, NULL, FALSE); + // } + // } + // } + // } + + // // draw the `buses' at either side of the screen + // r.left = X_PADDING - FONT_WIDTH; + // r.top = 0; + // r.right = r.left + 4; + // r.bottom = IoListTop; + // FillRect(Hdc, &r, InSimulationMode ? BusLeftBrush : BusBrush); + + // r.left += POS_WIDTH*FONT_WIDTH*ColsAvailable + 2; + // r.right += POS_WIDTH*FONT_WIDTH*ColsAvailable + 2; + // FillRect(Hdc, &r, InSimulationMode ? BusRightBus : BusBrush); - CursorDrawn = FALSE; + // CursorDrawn = FALSE; - BitBlt(paintDc, 0, 0, bw, bh, BackDc, ScrollXOffset, 0, SRCCOPY); + // BitBlt(paintDc, 0, 0, bw, bh, BackDc, ScrollXOffset, 0, SRCCOPY); - if(InSimulationMode) { - KillTimer(MainWindow, TIMER_BLINK_CURSOR); - } else { - KillTimer(MainWindow, TIMER_BLINK_CURSOR); - BlinkCursor(NULL, 0, NULL, 0); - SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor); - } + // if(InSimulationMode) { + // KillTimer(MainWindow, TIMER_BLINK_CURSOR); + // } else { + // KillTimer(MainWindow, TIMER_BLINK_CURSOR); + // BlinkCursor(NULL, 0, NULL, 0); + // SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor); + // } - Hdc = paintDc; - ok(); + // Hdc = paintDc; + // ok(); } //----------------------------------------------------------------------------- @@ -390,52 +390,52 @@ static void SetSyntaxHighlightingColours(void) //----------------------------------------------------------------------------- void InitForDrawing(void) { - SetSyntaxHighlightingColours(); - - FixedWidthFont = CreateFont( - FONT_HEIGHT, FONT_WIDTH, - 0, 0, - FW_REGULAR, - FALSE, - FALSE, - FALSE, - ANSI_CHARSET, - OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, - FF_DONTCARE, - "Lucida Console"); - - FixedWidthFontBold = CreateFont( - FONT_HEIGHT, FONT_WIDTH, - 0, 0, - FW_REGULAR, // the bold text renders funny under Vista - FALSE, - FALSE, - FALSE, - ANSI_CHARSET, - OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, - FF_DONTCARE, - "Lucida Console"); - - LOGBRUSH lb; - lb.lbStyle = BS_SOLID; - lb.lbColor = HighlightColours.simBusRight; - BusRightBus = CreateBrushIndirect(&lb); - - lb.lbColor = HighlightColours.simBusLeft; - BusLeftBrush = CreateBrushIndirect(&lb); - - lb.lbColor = HighlightColours.bus; - BusBrush = CreateBrushIndirect(&lb); - - lb.lbColor = HighlightColours.bg; - BgBrush = CreateBrushIndirect(&lb); - - lb.lbColor = HighlightColours.simBg; - SimBgBrush = CreateBrushIndirect(&lb); + // SetSyntaxHighlightingColours(); + + // FixedWidthFont = CreateFont( + // FONT_HEIGHT, FONT_WIDTH, + // 0, 0, + // FW_REGULAR, + // FALSE, + // FALSE, + // FALSE, + // ANSI_CHARSET, + // OUT_DEFAULT_PRECIS, + // CLIP_DEFAULT_PRECIS, + // DEFAULT_QUALITY, + // FF_DONTCARE, + // "Lucida Console"); + + // FixedWidthFontBold = CreateFont( + // FONT_HEIGHT, FONT_WIDTH, + // 0, 0, + // FW_REGULAR, // the bold text renders funny under Vista + // FALSE, + // FALSE, + // FALSE, + // ANSI_CHARSET, + // OUT_DEFAULT_PRECIS, + // CLIP_DEFAULT_PRECIS, + // DEFAULT_QUALITY, + // FF_DONTCARE, + // "Lucida Console"); + + // LOGBRUSH lb; + // lb.lbStyle = BS_SOLID; + // lb.lbColor = HighlightColours.simBusRight; + // BusRightBus = CreateBrushIndirect(&lb); + + // lb.lbColor = HighlightColours.simBusLeft; + // BusLeftBrush = CreateBrushIndirect(&lb); + + // lb.lbColor = HighlightColours.bus; + // BusBrush = CreateBrushIndirect(&lb); + + // lb.lbColor = HighlightColours.bg; + // BgBrush = CreateBrushIndirect(&lb); + + // lb.lbColor = HighlightColours.simBg; + // SimBgBrush = CreateBrushIndirect(&lb); } //----------------------------------------------------------------------------- @@ -458,105 +458,105 @@ static void DrawCharsToExportBuffer(int cx, int cy, char *str) //----------------------------------------------------------------------------- void ExportDrawingAsText(char *file) { - int maxWidth = ProgCountWidestRow(); - ColsAvailable = maxWidth; - - int totalHeight = 0; - int i; - for(i = 0; i < Prog.numRungs; i++) { - totalHeight += CountHeightOfElement(ELEM_SERIES_SUBCKT, Prog.rungs[i]); - totalHeight += 1; - } - totalHeight *= POS_HEIGHT; - totalHeight += 3; - - ExportBuffer = (char **)CheckMalloc(totalHeight * sizeof(char *)); + // int maxWidth = ProgCountWidestRow(); + // ColsAvailable = maxWidth; + + // int totalHeight = 0; + // int i; + // for(i = 0; i < Prog.numRungs; i++) { + // totalHeight += CountHeightOfElement(ELEM_SERIES_SUBCKT, Prog.rungs[i]); + // totalHeight += 1; + // } + // totalHeight *= POS_HEIGHT; + // totalHeight += 3; + + // ExportBuffer = (char **)CheckMalloc(totalHeight * sizeof(char *)); - int l = maxWidth*POS_WIDTH + 8; - for(i = 0; i < totalHeight; i++) { - ExportBuffer[i] = (char *)CheckMalloc(l); - memset(ExportBuffer[i], ' ', l-1); - ExportBuffer[i][4] = '|'; - ExportBuffer[i][3] = '|'; - ExportBuffer[i][l-3] = '|'; - ExportBuffer[i][l-2] = '|'; - ExportBuffer[i][l-1] = '\0'; - } - - DrawChars = DrawCharsToExportBuffer; - - int cy = 1; - for(i = 0; i < Prog.numRungs; i++) { - int cx = 5; - DrawElement(ELEM_SERIES_SUBCKT, Prog.rungs[i], &cx, &cy, - Prog.rungPowered[i]); - - if((i + 1) < 10) { - ExportBuffer[cy+1][1] = '0' + (i + 1); - } else { - ExportBuffer[cy+1][1] = '0' + ((i + 1) % 10); - ExportBuffer[cy+1][0] = '0' + ((i + 1) / 10); - } - - cy += POS_HEIGHT*CountHeightOfElement(ELEM_SERIES_SUBCKT, - Prog.rungs[i]); - cy += POS_HEIGHT; - } - cy -= 2; - DrawEndRung(5, cy); - - FILE *f = fopen(file, "w"); - if(!f) { - Error(_("Couldn't open '%s'\n"), f); - return; - } - - fprintf(f, "LDmicro export text\n"); - - if(Prog.mcu) { - fprintf(f, "for '%s', %.6f MHz crystal, %.1f ms cycle time\n\n", - Prog.mcu->mcuName, Prog.mcuClock/1e6, Prog.cycleTime/1e3); - } else { - fprintf(f, "no MCU assigned, %.6f MHz crystal, %.1f ms cycle time\n\n", - Prog.mcuClock/1e6, Prog.cycleTime/1e3); - } - - fprintf(f, "\nLADDER DIAGRAM:\n\n"); - - for(i = 0; i < totalHeight; i++) { - ExportBuffer[i][4] = '|'; - fprintf(f, "%s\n", ExportBuffer[i]); - CheckFree(ExportBuffer[i]); - } - CheckFree(ExportBuffer); - ExportBuffer = NULL; - - fprintf(f, _("\n\nI/O ASSIGNMENT:\n\n")); + // int l = maxWidth*POS_WIDTH + 8; + // for(i = 0; i < totalHeight; i++) { + // ExportBuffer[i] = (char *)CheckMalloc(l); + // memset(ExportBuffer[i], ' ', l-1); + // ExportBuffer[i][4] = '|'; + // ExportBuffer[i][3] = '|'; + // ExportBuffer[i][l-3] = '|'; + // ExportBuffer[i][l-2] = '|'; + // ExportBuffer[i][l-1] = '\0'; + // } + + // DrawChars = DrawCharsToExportBuffer; + + // int cy = 1; + // for(i = 0; i < Prog.numRungs; i++) { + // int cx = 5; + // DrawElement(ELEM_SERIES_SUBCKT, Prog.rungs[i], &cx, &cy, + // Prog.rungPowered[i]); + + // if((i + 1) < 10) { + // ExportBuffer[cy+1][1] = '0' + (i + 1); + // } else { + // ExportBuffer[cy+1][1] = '0' + ((i + 1) % 10); + // ExportBuffer[cy+1][0] = '0' + ((i + 1) / 10); + // } + + // cy += POS_HEIGHT*CountHeightOfElement(ELEM_SERIES_SUBCKT, + // Prog.rungs[i]); + // cy += POS_HEIGHT; + // } + // cy -= 2; + // DrawEndRung(5, cy); + + // FILE *f = fopen(file, "w"); + // if(!f) { + // Error(_("Couldn't open '%s'\n"), f); + // return; + // } + + // fprintf(f, "LDmicro export text\n"); + + // if(Prog.mcu) { + // fprintf(f, "for '%s', %.6f MHz crystal, %.1f ms cycle time\n\n", + // Prog.mcu->mcuName, Prog.mcuClock/1e6, Prog.cycleTime/1e3); + // } else { + // fprintf(f, "no MCU assigned, %.6f MHz crystal, %.1f ms cycle time\n\n", + // Prog.mcuClock/1e6, Prog.cycleTime/1e3); + // } + + // fprintf(f, "\nLADDER DIAGRAM:\n\n"); + + // for(i = 0; i < totalHeight; i++) { + // ExportBuffer[i][4] = '|'; + // fprintf(f, "%s\n", ExportBuffer[i]); + // CheckFree(ExportBuffer[i]); + // } + // CheckFree(ExportBuffer); + // ExportBuffer = NULL; + + // fprintf(f, _("\n\nI/O ASSIGNMENT:\n\n")); - fprintf(f, _(" Name | Type | Pin\n")); - fprintf(f, " ----------------------------+--------------------+------\n"); - for(i = 0; i < Prog.io.count; i++) { - char b[1024]; - memset(b, '\0', sizeof(b)); + // fprintf(f, _(" Name | Type | Pin\n")); + // fprintf(f, " ----------------------------+--------------------+------\n"); + // for(i = 0; i < Prog.io.count; i++) { + // char b[1024]; + // memset(b, '\0', sizeof(b)); - PlcProgramSingleIo *io = &Prog.io.assignment[i]; - char *type = IoTypeToString(io->type); - char pin[MAX_NAME_LEN]; + // PlcProgramSingleIo *io = &Prog.io.assignment[i]; + // char *type = IoTypeToString(io->type); + // char pin[MAX_NAME_LEN]; - PinNumberForIo(pin, io); + // PinNumberForIo(pin, io); - sprintf(b, " | | %s\n", - pin); + // sprintf(b, " | | %s\n", + // pin); - memcpy(b+2, io->name, strlen(io->name)); - memcpy(b+31, type, strlen(type)); - fprintf(f, "%s", b); - } + // memcpy(b+2, io->name, strlen(io->name)); + // memcpy(b+31, type, strlen(type)); + // fprintf(f, "%s", b); + // } - fclose(f); + // fclose(f); - // we may have trashed the grid tables a bit; a repaint will fix that - InvalidateRect(MainWindow, NULL, FALSE); + // // we may have trashed the grid tables a bit; a repaint will fix that + // InvalidateRect(MainWindow, NULL, FALSE); } //----------------------------------------------------------------------------- @@ -565,46 +565,46 @@ void ExportDrawingAsText(char *file) //----------------------------------------------------------------------------- void SetUpScrollbars(BOOL *horizShown, SCROLLINFO *horiz, SCROLLINFO *vert) { - int totalHeight = 0; - int i; - for(i = 0; i < Prog.numRungs; i++) { - totalHeight += CountHeightOfElement(ELEM_SERIES_SUBCKT, Prog.rungs[i]); - totalHeight++; - } - totalHeight += 1; // for the end rung - - int totalWidth = ProgCountWidestRow(); - - if(totalWidth <= ScreenColsAvailable()) { - *horizShown = FALSE; - ScrollXOffset = 0; - ScrollXOffsetMax = 0; - } else { - *horizShown = TRUE; - memset(horiz, 0, sizeof(*horiz)); - horiz->cbSize = sizeof(*horiz); - horiz->fMask = SIF_DISABLENOSCROLL | SIF_ALL; - horiz->nMin = 0; - horiz->nMax = X_PADDING + totalWidth*POS_WIDTH*FONT_WIDTH; - RECT r; - GetClientRect(MainWindow, &r); - horiz->nPage = r.right - X_PADDING; - horiz->nPos = ScrollXOffset; - - ScrollXOffsetMax = horiz->nMax - horiz->nPage + 1; - if(ScrollXOffset > ScrollXOffsetMax) ScrollXOffset = ScrollXOffsetMax; - if(ScrollXOffset < 0) ScrollXOffset = 0; - } - - vert->cbSize = sizeof(*vert); - vert->fMask = SIF_DISABLENOSCROLL | SIF_ALL; - vert->nMin = 0; - vert->nMax = totalHeight - 1; - vert->nPos = ScrollYOffset; - vert->nPage = ScreenRowsAvailable(); - - ScrollYOffsetMax = vert->nMax - vert->nPage + 1; - - if(ScrollYOffset > ScrollYOffsetMax) ScrollYOffset = ScrollYOffsetMax; - if(ScrollYOffset < 0) ScrollYOffset = 0; + // int totalHeight = 0; + // int i; + // for(i = 0; i < Prog.numRungs; i++) { + // totalHeight += CountHeightOfElement(ELEM_SERIES_SUBCKT, Prog.rungs[i]); + // totalHeight++; + // } + // totalHeight += 1; // for the end rung + + // int totalWidth = ProgCountWidestRow(); + + // if(totalWidth <= ScreenColsAvailable()) { + // *horizShown = FALSE; + // ScrollXOffset = 0; + // ScrollXOffsetMax = 0; + // } else { + // *horizShown = TRUE; + // memset(horiz, 0, sizeof(*horiz)); + // horiz->cbSize = sizeof(*horiz); + // horiz->fMask = SIF_DISABLENOSCROLL | SIF_ALL; + // horiz->nMin = 0; + // horiz->nMax = X_PADDING + totalWidth*POS_WIDTH*FONT_WIDTH; + // RECT r; + // GetClientRect(MainWindow, &r); + // horiz->nPage = r.right - X_PADDING; + // horiz->nPos = ScrollXOffset; + + // ScrollXOffsetMax = horiz->nMax - horiz->nPage + 1; + // if(ScrollXOffset > ScrollXOffsetMax) ScrollXOffset = ScrollXOffsetMax; + // if(ScrollXOffset < 0) ScrollXOffset = 0; + // } + + // vert->cbSize = sizeof(*vert); + // vert->fMask = SIF_DISABLENOSCROLL | SIF_ALL; + // vert->nMin = 0; + // vert->nMax = totalHeight - 1; + // vert->nPos = ScrollYOffset; + // vert->nPage = ScreenRowsAvailable(); + + // ScrollYOffsetMax = vert->nMax - vert->nPage + 1; + + // if(ScrollYOffset > ScrollYOffsetMax) ScrollYOffset = ScrollYOffsetMax; + // if(ScrollYOffset < 0) ScrollYOffset = 0; } diff --git a/ldmicro/helpdialog.cpp b/ldmicro/helpdialog.cpp index 9ac82af..cf23caa 100644 --- a/ldmicro/helpdialog.cpp +++ b/ldmicro/helpdialog.cpp @@ -23,10 +23,10 @@ // colours. // Jonathan Westhues, Dec 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> -#include <commctrl.h> +//#include <commctrl.h> #include <richedit.h> #include "ldmicro.h" diff --git a/ldmicro/includes/advanceddialog.h b/ldmicro/includes/advanceddialog.h index 5e4808f..5adadbc 100644 --- a/ldmicro/includes/advanceddialog.h +++ b/ldmicro/includes/advanceddialog.h @@ -1,142 +1,142 @@ -#ifndef _ADVANCED_DIALOG_H -#define _ADVANCED_DIALOG_H - -#define MAX_PIN_NAME 128 - -/*Advanced Dialog Menus*/ -#define MNU_ADV_NEW 0x01 -#define MNU_ADV_OPEN 0x02 -#define MNU_ADV_SAVE 0x03 -#define MNU_ADV_SAVE_AS 0x04 -#define MNU_ADV_EXIT 0x05 - -#define MNU_ADV_UNDO 0x10 -#define MNU_ADV_REDO 0x11 -#define MNU_ADV_CUT 0x12 -#define MNU_ADV_COPY 0x13 -#define MNU_ADV_PASTE 0x14 -#define MNU_ADV_DEL 0x15 - -#define MNU_ADV_SIMULATION_MODE 0x20 -#define MNU_ADV_START_SIMULATION 0x21 -#define MNU_ADV_STOP_SIMULATION 0x22 -#define MNU_ADV_SINGLE_CYCLE 0x23 - -#define MNU_ADV_MANUAL 0x30 -#define MNU_ADV_ABOUT 0x31 - -#define MAX_NAME_LENGTH 128 -#define MAX_SCREEN_ITEMS 512 -#define MAX_PINS 4000 -#define MCU_PIN_FLAG 4000 -#define MAX_MCU_PINS 128 -#define TIMER_ADV_SIMULATE 101 - - -typedef struct ImageStructTag { - int selectedState; - HIMAGELIST Images; - int ComponentId; -} ImageStruct; - -typedef struct ImageLocationTag{ - int Id; - ImageStruct* Image; - int Index; - int x; - int y; - void* Properties; - void* PinId; - void* PinName; -}ImageLocation; - -typedef struct PinInfoTag{ - double Volt; - double OperatingVolt; - void** ImageId; - int* Index; - int* ImageType; //To compare with imagelocation array - int LinkCount; //No of valid entries in array - double ProgVolt; - void* ProgComponent; -}PinInfo; - -typedef struct PinMcuTag{ - UINT PinId; - UINT state; - int type; - BOOL InternalPullup; -}PinMcu; - -typedef struct PinNameTag{ - UINT PinId; //Need to generate unique pinid every time user saves a name - TCHAR Name[MAX_NAME_LENGTH]; - PinInfo PinData; -}PinName; - -typedef struct PinComponentTag{ - UINT PinId; - void** ComponentAddress; - int Count; - void* Next; -}PinComponent; - -extern HANDLE ImageHeap; -extern HFONT AdvNiceFont; -extern HFONT AdvFixedFont; -extern UINT NameCount; -extern ImageLocation ImageStack[MAX_SCREEN_ITEMS]; -// extern PinInfo PinData[MAX_PINS]; -extern PinMcu McuPin[MAX_MCU_PINS]; -extern PinName NameId[MAX_PINS]; -extern HWND AdvancedDialog; -extern PinComponent ComponentPin; - -/*Advanced Dialog Functions*/ -void MakeAdvancedDialogControls(void); -void AdvancedDialogResized(void); -void MakeAdvancedWindowMenus(void); -void ProcessEvent(int x, int y, int Event); -void AdvancedWindowClosing(void); -void ToggleAdvancedSimulationMode(void); -void SimulateOneAdvCycle(BOOL ForceRefresh); -int IsMCUPin(int PinId); -// void CreateVoltRequest(int PinId, int Index, double VoltReq); - -// Heap Functions -void* AllocImageHeap(size_t n); -void* ReallocImageHeap(LPVOID lpMem, size_t n); -void FreeImageHeap(void *p); - -// Component Functions - -void InitComponents(void); - -double GetGlobalVoltage(int PinId, void* ComponentAddress); -double RefreshVolt(int PinId, int Index, UINT Id, void* ComponentAddress, double volt); -double RefreshProcessorStat(int PinId, UINT Id); - - -int RegisterPinName(LPCTSTR Name); -int SetPinImage(int PinId,void* ImageId,int ImageType, int Index); -int FlushPinNames(void); //Clear Pins which are deleted from MainWindow -int DeRegisterPinName(LPCTSTR Name, void* ImageId); -int DeletePinImage(LPCTSTR Name, void* ImageId, int Index); -int DeletePinName(UINT Index); -void SetMcu(int PinId, int Type); -void RefreshNamingList(void); -void PopulateNamingList(void); - -double RequestVoltChange(int PinId, int Index, void *ComponentAddress, double volt); - -int DeleteComponentPin(int PinId, void* ComponentAddress); -int AddComponentPin(int PinId, void* ComponentAddress); -// int RegisterPinState(int Index, double Volt); - -//NamingList functions -void ToggleInternalPullup(int PinId); - - -extern BOOL SimulationStarted; - -#endif +// #ifndef _ADVANCED_DIALOG_H +// #define _ADVANCED_DIALOG_H + +// #define MAX_PIN_NAME 128 + +// /*Advanced Dialog Menus*/ +// #define MNU_ADV_NEW 0x01 +// #define MNU_ADV_OPEN 0x02 +// #define MNU_ADV_SAVE 0x03 +// #define MNU_ADV_SAVE_AS 0x04 +// #define MNU_ADV_EXIT 0x05 + +// #define MNU_ADV_UNDO 0x10 +// #define MNU_ADV_REDO 0x11 +// #define MNU_ADV_CUT 0x12 +// #define MNU_ADV_COPY 0x13 +// #define MNU_ADV_PASTE 0x14 +// #define MNU_ADV_DEL 0x15 + +// #define MNU_ADV_SIMULATION_MODE 0x20 +// #define MNU_ADV_START_SIMULATION 0x21 +// #define MNU_ADV_STOP_SIMULATION 0x22 +// #define MNU_ADV_SINGLE_CYCLE 0x23 + +// #define MNU_ADV_MANUAL 0x30 +// #define MNU_ADV_ABOUT 0x31 + +// #define MAX_NAME_LENGTH 128 +// #define MAX_SCREEN_ITEMS 512 +// #define MAX_PINS 4000 +// #define MCU_PIN_FLAG 4000 +// #define MAX_MCU_PINS 128 +// #define TIMER_ADV_SIMULATE 101 + + +// typedef struct ImageStructTag { +// int selectedState; +// HIMAGELIST Images; +// int ComponentId; +// } ImageStruct; + +// typedef struct ImageLocationTag{ +// int Id; +// ImageStruct* Image; +// int Index; +// int x; +// int y; +// void* Properties; +// void* PinId; +// void* PinName; +// }ImageLocation; + +// typedef struct PinInfoTag{ +// double Volt; +// double OperatingVolt; +// void** ImageId; +// int* Index; +// int* ImageType; //To compare with imagelocation array +// int LinkCount; //No of valid entries in array +// double ProgVolt; +// void* ProgComponent; +// }PinInfo; + +// typedef struct PinMcuTag{ +// UINT PinId; +// UINT state; +// int type; +// BOOL InternalPullup; +// }PinMcu; + +// typedef struct PinNameTag{ +// UINT PinId; //Need to generate unique pinid every time user saves a name +// TCHAR Name[MAX_NAME_LENGTH]; +// PinInfo PinData; +// }PinName; + +// typedef struct PinComponentTag{ +// UINT PinId; +// void** ComponentAddress; +// int Count; +// void* Next; +// }PinComponent; + +// extern HANDLE ImageHeap; +// extern HFONT AdvNiceFont; +// extern HFONT AdvFixedFont; +// extern UINT NameCount; +// extern ImageLocation ImageStack[MAX_SCREEN_ITEMS]; +// // extern PinInfo PinData[MAX_PINS]; +// extern PinMcu McuPin[MAX_MCU_PINS]; +// extern PinName NameId[MAX_PINS]; +// extern HWND AdvancedDialog; +// extern PinComponent ComponentPin; + +// /*Advanced Dialog Functions*/ +// void MakeAdvancedDialogControls(void); +// void AdvancedDialogResized(void); +// void MakeAdvancedWindowMenus(void); +// void ProcessEvent(int x, int y, int Event); +// void AdvancedWindowClosing(void); +// void ToggleAdvancedSimulationMode(void); +// void SimulateOneAdvCycle(BOOL ForceRefresh); +// int IsMCUPin(int PinId); +// // void CreateVoltRequest(int PinId, int Index, double VoltReq); + +// // Heap Functions +// void* AllocImageHeap(size_t n); +// void* ReallocImageHeap(LPVOID lpMem, size_t n); +// void FreeImageHeap(void *p); + +// // Component Functions + +// void InitComponents(void); + +// double GetGlobalVoltage(int PinId, void* ComponentAddress); +// double RefreshVolt(int PinId, int Index, UINT Id, void* ComponentAddress, double volt); +// double RefreshProcessorStat(int PinId, UINT Id); + + +// int RegisterPinName(LPCTSTR Name); +// int SetPinImage(int PinId,void* ImageId,int ImageType, int Index); +// int FlushPinNames(void); //Clear Pins which are deleted from MainWindow +// int DeRegisterPinName(LPCTSTR Name, void* ImageId); +// int DeletePinImage(LPCTSTR Name, void* ImageId, int Index); +// int DeletePinName(UINT Index); +// void SetMcu(int PinId, int Type); +// void RefreshNamingList(void); +// void PopulateNamingList(void); + +// double RequestVoltChange(int PinId, int Index, void *ComponentAddress, double volt); + +// int DeleteComponentPin(int PinId, void* ComponentAddress); +// int AddComponentPin(int PinId, void* ComponentAddress); +// // int RegisterPinState(int Index, double Volt); + +// //NamingList functions +// void ToggleInternalPullup(int PinId); + + +// extern BOOL SimulationStarted; + +// #endif diff --git a/ldmicro/includes/ldmicro.h b/ldmicro/includes/ldmicro.h index e434b82..e6edddc 100644 --- a/ldmicro/includes/ldmicro.h +++ b/ldmicro/includes/ldmicro.h @@ -501,20 +501,19 @@ typedef struct McuIoInfoTag { #define NUM_SUPPORTED_MCUS 16 -/* //----------------------------------------------- // Function prototypes // ldmicro.cpp void ProgramChanged(void); -*/ + void SetMenusEnabled(BOOL canNegate, BOOL canNormal, BOOL canResetOnly, BOOL canSetOnly, BOOL canDelete, BOOL canInsertEnd, BOOL canInsertOther, BOOL canPushRungDown, BOOL canPushRungUp, BOOL canInsertComment); -/* + void SetUndoEnabled(BOOL undoEnabled, BOOL redoEnabled); void RefreshScrollbars(void); -extern HINSTANCE Instance;*/ +extern HINSTANCE Instance; extern HWID MainWindow; extern HDC Hdc; extern PlcProgram Prog; @@ -557,14 +556,14 @@ extern BOOL SelectionActive; extern BOOL ThisHighlighted; // draw_outputdev.cpp -extern void (*DrawChars)(int, int, char *); -void CALLBACK BlinkCursor(HWND hwnd, UINT msg, UINT_PTR id, DWORD time); -void PaintWindow(void); -void ExportDrawingAsText(char *file); -void InitForDrawing(void); -void SetUpScrollbars(BOOL *horizShown, SCROLLINFO *horiz, SCROLLINFO *vert); -int ScreenRowsAvailable(void); -int ScreenColsAvailable(void); +// extern void (*DrawChars)(int, int, char *); +// void CALLBACK BlinkCursor(HWND hwnd, UINT msg, UINT_PTR id, DWORD time); +// void PaintWindow(void); +// void ExportDrawingAsText(char *file); +// void InitForDrawing(void); +// void SetUpScrollbars(BOOL *horizShown, SCROLLINFO *horiz, SCROLLINFO *vert); +// int ScreenRowsAvailable(void); +// int ScreenColsAvailable(void); extern HFONT FixedWidthFont; extern HFONT FixedWidthFontBold; extern int SelectedGxAfterNextPaint; @@ -706,6 +705,7 @@ void ShowHelpDialog(BOOL about); Error("Internal error at line %d file '%s'\n", __LINE__, __FILE__); \ exit(1); \ } + void dbp(char *str, ...); void Error(char *str, ...); void *CheckMalloc(size_t n); @@ -780,5 +780,5 @@ void CompileAnsiC(char *outFile); void CompileInterpreted(char *outFile); //Arduino.cpp void CompileArduino(char *outFile); -*/ + #endif diff --git a/ldmicro/intcode.cpp b/ldmicro/intcode.cpp index 6f1cf15..a577759 100644 --- a/ldmicro/intcode.cpp +++ b/ldmicro/intcode.cpp @@ -22,7 +22,7 @@ // AVR or PIC16 code. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <setjmp.h> #include <stdlib.h> diff --git a/ldmicro/interpreted.cpp b/ldmicro/interpreted.cpp index 721086a..2295f90 100644 --- a/ldmicro/interpreted.cpp +++ b/ldmicro/interpreted.cpp @@ -22,7 +22,7 @@ // for interpretation. // Jonathan Westhues, Aug 2005 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <setjmp.h> #include <stdlib.h> diff --git a/ldmicro/iolist.cpp b/ldmicro/iolist.cpp index 15b89c8..e2fc032 100644 --- a/ldmicro/iolist.cpp +++ b/ldmicro/iolist.cpp @@ -25,8 +25,8 @@ // will not be forgotten. Also the dialog box for assigning I/O pins. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> -#include <commctrl.h> +#include "linuxUI.h" +//#include <commctrl.h> #include <stdio.h> #include <stdlib.h> @@ -42,21 +42,21 @@ static struct { } IoSeenPreviously[MAX_IO_SEEN_PREVIOUSLY]; static int IoSeenPreviouslyCount; -// stuff for the dialog box that lets you choose pin assignments -static BOOL DialogDone; -static BOOL DialogCancel; +// // stuff for the dialog box that lets you choose pin assignments +// static BOOL DialogDone; +// static BOOL DialogCancel; -static HWND IoDialog; +// static HWND IoDialog; -static HWND PinList; -static HWND OkButton; -static HWND CancelButton; +// static HWND PinList; +// static HWND OkButton; +// static HWND CancelButton; -// stuff for the popup that lets you set the simulated value of an analog in -static HWND AnalogSliderMain; -static HWND AnalogSliderTrackbar; -static BOOL AnalogSliderDone; -static BOOL AnalogSliderCancel; +// // stuff for the popup that lets you set the simulated value of an analog in +// static HWND AnalogSliderMain; +// static HWND AnalogSliderTrackbar; +// static BOOL AnalogSliderDone; +// static BOOL AnalogSliderCancel; //----------------------------------------------------------------------------- @@ -394,372 +394,372 @@ void SaveIoListToFile(FILE *f) // Dialog proc for the popup that lets you set the value of an analog input for // simulation. //----------------------------------------------------------------------------- -static LRESULT CALLBACK AnalogSliderDialogProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_CLOSE: - case WM_DESTROY: - AnalogSliderDone = TRUE; - AnalogSliderCancel = TRUE; - return 1; - - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } -} +// static LRESULT CALLBACK AnalogSliderDialogProc(HWND hwnd, UINT msg, +// WPARAM wParam, LPARAM lParam) +// { +// switch (msg) { +// case WM_CLOSE: +// case WM_DESTROY: +// AnalogSliderDone = TRUE; +// AnalogSliderCancel = TRUE; +// return 1; + +// default: +// return DefWindowProc(hwnd, msg, wParam, lParam); +// } +// } //----------------------------------------------------------------------------- // A little toolbar-style window that pops up to allow the user to set the // simulated value of an ADC pin. //----------------------------------------------------------------------------- -void ShowAnalogSliderPopup(char *name) -{ - WNDCLASSEX wc; - memset(&wc, 0, sizeof(wc)); - wc.cbSize = sizeof(wc); - - wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | - CS_DBLCLKS; - wc.lpfnWndProc = (WNDPROC)AnalogSliderDialogProc; - wc.hInstance = Instance; - wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; - wc.lpszClassName = "LDmicroAnalogSlider"; - wc.lpszMenuName = NULL; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - - RegisterClassEx(&wc); - - POINT pt; - GetCursorPos(&pt); - - SWORD currentVal = GetAdcShadow(name); - - SWORD maxVal; - if(Prog.mcu) { - maxVal = Prog.mcu->adcMax; - } else { - maxVal = 1023; - } - if(maxVal == 0) { - Error(_("No ADC or ADC not supported for selected micro.")); - return; - } - - int left = pt.x - 10; - // try to put the slider directly under the cursor (though later we might - // realize that that would put the popup off the screen) - int top = pt.y - (15 + (73*currentVal)/maxVal); - - RECT r; - SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0); - - if(top + 110 >= r.bottom) { - top = r.bottom - 110; - } - if(top < 0) top = 0; +// void ShowAnalogSliderPopup(char *name) +// { +// WNDCLASSEX wc; +// memset(&wc, 0, sizeof(wc)); +// wc.cbSize = sizeof(wc); + +// wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | +// CS_DBLCLKS; +// wc.lpfnWndProc = (WNDPROC)AnalogSliderDialogProc; +// wc.hInstance = Instance; +// wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; +// wc.lpszClassName = "LDmicroAnalogSlider"; +// wc.lpszMenuName = NULL; +// wc.hCursor = LoadCursor(NULL, IDC_ARROW); + +// RegisterClassEx(&wc); + +// POINT pt; +// GetCursorPos(&pt); + +// SWORD currentVal = GetAdcShadow(name); + +// SWORD maxVal; +// if(Prog.mcu) { +// maxVal = Prog.mcu->adcMax; +// } else { +// maxVal = 1023; +// } +// if(maxVal == 0) { +// Error(_("No ADC or ADC not supported for selected micro.")); +// return; +// } + +// int left = pt.x - 10; +// // try to put the slider directly under the cursor (though later we might +// // realize that that would put the popup off the screen) +// int top = pt.y - (15 + (73*currentVal)/maxVal); + +// RECT r; +// SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0); + +// if(top + 110 >= r.bottom) { +// top = r.bottom - 110; +// } +// if(top < 0) top = 0; - AnalogSliderMain = CreateWindowClient(0, "LDmicroAnalogSlider", "I/O Pin", - WS_VISIBLE | WS_POPUP | WS_DLGFRAME, - left, top, 30, 100, NULL, NULL, Instance, NULL); - - AnalogSliderTrackbar = CreateWindowEx(0, TRACKBAR_CLASS, "", WS_CHILD | - TBS_AUTOTICKS | TBS_VERT | TBS_TOOLTIPS | WS_CLIPSIBLINGS | WS_VISIBLE, - 0, 0, 30, 100, AnalogSliderMain, NULL, Instance, NULL); - SendMessage(AnalogSliderTrackbar, TBM_SETRANGE, FALSE, - MAKELONG(0, maxVal)); - SendMessage(AnalogSliderTrackbar, TBM_SETTICFREQ, (maxVal + 1)/8, 0); - SendMessage(AnalogSliderTrackbar, TBM_SETPOS, TRUE, currentVal); - - EnableWindow(MainWindow, FALSE); - ShowWindow(AnalogSliderMain, TRUE); - SetFocus(AnalogSliderTrackbar); - - DWORD ret; - MSG msg; - AnalogSliderDone = FALSE; - AnalogSliderCancel = FALSE; - - SWORD orig = GetAdcShadow(name); - - while(!AnalogSliderDone && (ret = GetMessage(&msg, NULL, 0, 0))) { - SWORD v = (SWORD)SendMessage(AnalogSliderTrackbar, TBM_GETPOS, 0, 0); - - if(msg.message == WM_KEYDOWN) { - if(msg.wParam == VK_RETURN) { - AnalogSliderDone = TRUE; - break; - } else if(msg.wParam == VK_ESCAPE) { - AnalogSliderDone = TRUE; - AnalogSliderCancel = TRUE; - break; - } - } else if(msg.message == WM_LBUTTONUP) { - if(v != orig) { - AnalogSliderDone = TRUE; - } - } - SetAdcShadow(name, v); - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if(!AnalogSliderCancel) { - SWORD v = (SWORD)SendMessage(AnalogSliderTrackbar, TBM_GETPOS, 0, 0); - SetAdcShadow(name, v); - } - - EnableWindow(MainWindow, TRUE); - DestroyWindow(AnalogSliderMain); - ListView_RedrawItems(IoList, 0, Prog.io.count - 1); -} +// AnalogSliderMain = CreateWindowClient(0, "LDmicroAnalogSlider", "I/O Pin", +// WS_VISIBLE | WS_POPUP | WS_DLGFRAME, +// left, top, 30, 100, NULL, NULL, Instance, NULL); + +// AnalogSliderTrackbar = CreateWindowEx(0, TRACKBAR_CLASS, "", WS_CHILD | +// TBS_AUTOTICKS | TBS_VERT | TBS_TOOLTIPS | WS_CLIPSIBLINGS | WS_VISIBLE, +// 0, 0, 30, 100, AnalogSliderMain, NULL, Instance, NULL); +// SendMessage(AnalogSliderTrackbar, TBM_SETRANGE, FALSE, +// MAKELONG(0, maxVal)); +// SendMessage(AnalogSliderTrackbar, TBM_SETTICFREQ, (maxVal + 1)/8, 0); +// SendMessage(AnalogSliderTrackbar, TBM_SETPOS, TRUE, currentVal); + +// EnableWindow(MainWindow, FALSE); +// ShowWindow(AnalogSliderMain, TRUE); +// SetFocus(AnalogSliderTrackbar); + +// DWORD ret; +// MSG msg; +// AnalogSliderDone = FALSE; +// AnalogSliderCancel = FALSE; + +// SWORD orig = GetAdcShadow(name); + +// while(!AnalogSliderDone && (ret = GetMessage(&msg, NULL, 0, 0))) { +// SWORD v = (SWORD)SendMessage(AnalogSliderTrackbar, TBM_GETPOS, 0, 0); + +// if(msg.message == WM_KEYDOWN) { +// if(msg.wParam == VK_RETURN) { +// AnalogSliderDone = TRUE; +// break; +// } else if(msg.wParam == VK_ESCAPE) { +// AnalogSliderDone = TRUE; +// AnalogSliderCancel = TRUE; +// break; +// } +// } else if(msg.message == WM_LBUTTONUP) { +// if(v != orig) { +// AnalogSliderDone = TRUE; +// } +// } +// SetAdcShadow(name, v); + +// TranslateMessage(&msg); +// DispatchMessage(&msg); +// } + +// if(!AnalogSliderCancel) { +// SWORD v = (SWORD)SendMessage(AnalogSliderTrackbar, TBM_GETPOS, 0, 0); +// SetAdcShadow(name, v); +// } + +// EnableWindow(MainWindow, TRUE); +// DestroyWindow(AnalogSliderMain); +// ListView_RedrawItems(IoList, 0, Prog.io.count - 1); +// } //----------------------------------------------------------------------------- // Window proc for the contacts dialog box //----------------------------------------------------------------------------- -static LRESULT CALLBACK IoDialogProc(HWND hwnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - switch (msg) { - case WM_COMMAND: { - HWND h = (HWND)lParam; - if(h == OkButton && wParam == BN_CLICKED) { - DialogDone = TRUE; - } else if(h == CancelButton && wParam == BN_CLICKED) { - DialogDone = TRUE; - DialogCancel = TRUE; - } else if(h == PinList && HIWORD(wParam) == LBN_DBLCLK) { - DialogDone = TRUE; - } - break; - } - - case WM_CLOSE: - case WM_DESTROY: - DialogDone = TRUE; - DialogCancel = TRUE; - return 1; - - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } - - return 1; -} +// static LRESULT CALLBACK IoDialogProc(HWND hwnd, UINT msg, WPARAM wParam, +// LPARAM lParam) +// { +// switch (msg) { +// case WM_COMMAND: { +// HWND h = (HWND)lParam; +// if(h == OkButton && wParam == BN_CLICKED) { +// DialogDone = TRUE; +// } else if(h == CancelButton && wParam == BN_CLICKED) { +// DialogDone = TRUE; +// DialogCancel = TRUE; +// } else if(h == PinList && HIWORD(wParam) == LBN_DBLCLK) { +// DialogDone = TRUE; +// } +// break; +// } + +// case WM_CLOSE: +// case WM_DESTROY: +// DialogDone = TRUE; +// DialogCancel = TRUE; +// return 1; + +// default: +// return DefWindowProc(hwnd, msg, wParam, lParam); +// } + +// return 1; +// } //----------------------------------------------------------------------------- // Create our window class; nothing exciting. //----------------------------------------------------------------------------- -static BOOL MakeWindowClass() -{ - WNDCLASSEX wc; - memset(&wc, 0, sizeof(wc)); - wc.cbSize = sizeof(wc); - - wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | - CS_DBLCLKS; - wc.lpfnWndProc = (WNDPROC)IoDialogProc; - wc.hInstance = Instance; - wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; - wc.lpszClassName = "LDmicroIo"; - wc.lpszMenuName = NULL; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hIcon = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), - IMAGE_ICON, 32, 32, 0); - wc.hIconSm = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), - IMAGE_ICON, 16, 16, 0); - - return RegisterClassEx(&wc); -} - -static void MakeControls(void) -{ - HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Assign:"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, - 6, 1, 80, 17, IoDialog, NULL, Instance, NULL); - NiceFont(textLabel); - - PinList = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTBOX, "", - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | WS_VSCROLL | - LBS_NOTIFY, 6, 18, 95, 320, IoDialog, NULL, Instance, NULL); - FixedFont(PinList); - - OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, - 6, 325, 95, 23, IoDialog, NULL, Instance, NULL); - NiceFont(OkButton); - - CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 6, 356, 95, 23, IoDialog, NULL, Instance, NULL); - NiceFont(CancelButton); -} - -void ShowIoDialog(int item) -{ - if(!Prog.mcu) { - MessageBox(MainWindow, - _("No microcontroller has been selected. You must select a " - "microcontroller before you can assign I/O pins.\r\n\r\n" - "Select a microcontroller under the Settings menu and try " - "again."), _("I/O Pin Assignment"), MB_OK | MB_ICONWARNING); - return; - } - - if(Prog.mcu->whichIsa == ISA_ANSIC) { - Error(_("Can't specify I/O assignment for ANSI C target; compile and " - "see comments in generated source code.")); - return; - } - - if(Prog.mcu->whichIsa == ISA_INTERPRETED) { - Error(_("Can't specify I/O assignment for interpretable target; see " - "comments in reference implementation of interpreter.")); - return; - } - - if(Prog.io.assignment[item].name[0] != 'X' && - Prog.io.assignment[item].name[0] != 'Y' && - Prog.io.assignment[item].name[0] != 'A') - { - Error(_("Can only assign pin number to input/output pins (Xname or " - "Yname or Aname).")); - return; - } - - if(Prog.io.assignment[item].name[0] == 'A' && Prog.mcu->adcCount == 0) { - Error(_("No ADC or ADC not supported for this micro.")); - return; - } - - if(strcmp(Prog.io.assignment[item].name+1, "new")==0) { - Error(_("Rename I/O from default name ('%s') before assigning " - "MCU pin."), Prog.io.assignment[item].name); - return; - } - - MakeWindowClass(); - - // We need the TOOLWINDOW style, or else the window will be forced to - // a minimum width greater than our current width. And without the - // APPWINDOW style, it becomes impossible to get the window back (by - // Alt+Tab or taskbar). - IoDialog = CreateWindowClient(WS_EX_TOOLWINDOW | WS_EX_APPWINDOW, - "LDmicroIo", _("I/O Pin"), - WS_OVERLAPPED | WS_SYSMENU, - 100, 100, 107, 387, NULL, NULL, Instance, NULL); - - MakeControls(); - - SendMessage(PinList, LB_ADDSTRING, 0, (LPARAM)_("(no pin)")); - int i; - for(i = 0; i < Prog.mcu->pinCount; i++) { - int j; - for(j = 0; j < Prog.io.count; j++) { - if(j == item) continue; - if(Prog.io.assignment[j].pin == Prog.mcu->pinInfo[i].pin) { - goto cant_use_this_io; - } - } - - if(UartFunctionUsed() && Prog.mcu && - ((Prog.mcu->pinInfo[i].pin == Prog.mcu->uartNeeds.rxPin) || - (Prog.mcu->pinInfo[i].pin == Prog.mcu->uartNeeds.txPin))) - { - goto cant_use_this_io; - } - - if(PwmFunctionUsed() && - Prog.mcu->pinInfo[i].pin == Prog.mcu->pwmNeedsPin) - { - goto cant_use_this_io; - } - - if(Prog.io.assignment[item].name[0] == 'A') { - for(j = 0; j < Prog.mcu->adcCount; j++) { - if(Prog.mcu->adcInfo[j].pin == Prog.mcu->pinInfo[i].pin) { - // okay; we know how to connect it up to the ADC - break; - } - } - if(j == Prog.mcu->adcCount) { - goto cant_use_this_io; - } - } - - char buf[40]; - if(Prog.mcu->pinCount <= 21) { - sprintf(buf, "%3d %c%c%d", Prog.mcu->pinInfo[i].pin, - Prog.mcu->portPrefix, Prog.mcu->pinInfo[i].port, - Prog.mcu->pinInfo[i].bit); - } else { - sprintf(buf, "%3d %c%c%d", Prog.mcu->pinInfo[i].pin, - Prog.mcu->portPrefix, Prog.mcu->pinInfo[i].port, - Prog.mcu->pinInfo[i].bit); - } - SendMessage(PinList, LB_ADDSTRING, 0, (LPARAM)buf); -cant_use_this_io:; - } - - EnableWindow(MainWindow, FALSE); - ShowWindow(IoDialog, TRUE); - SetFocus(PinList); - - MSG msg; - DWORD ret; - DialogDone = FALSE; - DialogCancel = FALSE; - while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { - if(msg.message == WM_KEYDOWN) { - if(msg.wParam == VK_RETURN) { - DialogDone = TRUE; - break; - } else if(msg.wParam == VK_ESCAPE) { - DialogDone = TRUE; - DialogCancel = TRUE; - break; - } - } - - if(IsDialogMessage(IoDialog, &msg)) continue; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if(!DialogCancel) { - int sel = SendMessage(PinList, LB_GETCURSEL, 0, 0); - char pin[16]; - SendMessage(PinList, LB_GETTEXT, (WPARAM)sel, (LPARAM)pin); - if(strcmp(pin, _("(no pin)"))==0) { - int i; - for(i = 0; i < IoSeenPreviouslyCount; i++) { - if(strcmp(IoSeenPreviously[i].name, - Prog.io.assignment[item].name)==0) - { - IoSeenPreviously[i].pin = NO_PIN_ASSIGNED; - } - } - Prog.io.assignment[item].pin = NO_PIN_ASSIGNED; - } else { - Prog.io.assignment[item].pin = atoi(pin); - // Only one name can be bound to each pin; make sure that there's - // not another entry for this pin in the IoSeenPreviously list, - // that might get used if the user creates a new pin with that - // name. - int i; - for(i = 0; i < IoSeenPreviouslyCount; i++) { - if(IoSeenPreviously[i].pin == atoi(pin)) { - IoSeenPreviously[i].pin = NO_PIN_ASSIGNED; - } - } - } - } - - EnableWindow(MainWindow, TRUE); - DestroyWindow(IoDialog); - return; -} +// static BOOL MakeWindowClass() +// { +// WNDCLASSEX wc; +// memset(&wc, 0, sizeof(wc)); +// wc.cbSize = sizeof(wc); + +// wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | +// CS_DBLCLKS; +// wc.lpfnWndProc = (WNDPROC)IoDialogProc; +// wc.hInstance = Instance; +// wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; +// wc.lpszClassName = "LDmicroIo"; +// wc.lpszMenuName = NULL; +// wc.hCursor = LoadCursor(NULL, IDC_ARROW); +// wc.hIcon = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), +// IMAGE_ICON, 32, 32, 0); +// wc.hIconSm = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), +// IMAGE_ICON, 16, 16, 0); + +// return RegisterClassEx(&wc); +// } + +// static void MakeControls(void) +// { +// HWND textLabel = CreateWindowEx(0, WC_STATIC, _("Assign:"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, +// 6, 1, 80, 17, IoDialog, NULL, Instance, NULL); +// NiceFont(textLabel); + +// PinList = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTBOX, "", +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | WS_VSCROLL | +// LBS_NOTIFY, 6, 18, 95, 320, IoDialog, NULL, Instance, NULL); +// FixedFont(PinList); + +// OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, +// 6, 325, 95, 23, IoDialog, NULL, Instance, NULL); +// NiceFont(OkButton); + +// CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 6, 356, 95, 23, IoDialog, NULL, Instance, NULL); +// NiceFont(CancelButton); +// } + +// void ShowIoDialog(int item) +// { +// if(!Prog.mcu) { +// MessageBox(MainWindow, +// _("No microcontroller has been selected. You must select a " +// "microcontroller before you can assign I/O pins.\r\n\r\n" +// "Select a microcontroller under the Settings menu and try " +// "again."), _("I/O Pin Assignment"), MB_OK | MB_ICONWARNING); +// return; +// } + +// if(Prog.mcu->whichIsa == ISA_ANSIC) { +// Error(_("Can't specify I/O assignment for ANSI C target; compile and " +// "see comments in generated source code.")); +// return; +// } + +// if(Prog.mcu->whichIsa == ISA_INTERPRETED) { +// Error(_("Can't specify I/O assignment for interpretable target; see " +// "comments in reference implementation of interpreter.")); +// return; +// } + +// if(Prog.io.assignment[item].name[0] != 'X' && +// Prog.io.assignment[item].name[0] != 'Y' && +// Prog.io.assignment[item].name[0] != 'A') +// { +// Error(_("Can only assign pin number to input/output pins (Xname or " +// "Yname or Aname).")); +// return; +// } + +// if(Prog.io.assignment[item].name[0] == 'A' && Prog.mcu->adcCount == 0) { +// Error(_("No ADC or ADC not supported for this micro.")); +// return; +// } + +// if(strcmp(Prog.io.assignment[item].name+1, "new")==0) { +// Error(_("Rename I/O from default name ('%s') before assigning " +// "MCU pin."), Prog.io.assignment[item].name); +// return; +// } + +// MakeWindowClass(); + +// // We need the TOOLWINDOW style, or else the window will be forced to +// // a minimum width greater than our current width. And without the +// // APPWINDOW style, it becomes impossible to get the window back (by +// // Alt+Tab or taskbar). +// IoDialog = CreateWindowClient(WS_EX_TOOLWINDOW | WS_EX_APPWINDOW, +// "LDmicroIo", _("I/O Pin"), +// WS_OVERLAPPED | WS_SYSMENU, +// 100, 100, 107, 387, NULL, NULL, Instance, NULL); + +// MakeControls(); + +// SendMessage(PinList, LB_ADDSTRING, 0, (LPARAM)_("(no pin)")); +// int i; +// for(i = 0; i < Prog.mcu->pinCount; i++) { +// int j; +// for(j = 0; j < Prog.io.count; j++) { +// if(j == item) continue; +// if(Prog.io.assignment[j].pin == Prog.mcu->pinInfo[i].pin) { +// goto cant_use_this_io; +// } +// } + +// if(UartFunctionUsed() && Prog.mcu && +// ((Prog.mcu->pinInfo[i].pin == Prog.mcu->uartNeeds.rxPin) || +// (Prog.mcu->pinInfo[i].pin == Prog.mcu->uartNeeds.txPin))) +// { +// goto cant_use_this_io; +// } + +// if(PwmFunctionUsed() && +// Prog.mcu->pinInfo[i].pin == Prog.mcu->pwmNeedsPin) +// { +// goto cant_use_this_io; +// } + +// if(Prog.io.assignment[item].name[0] == 'A') { +// for(j = 0; j < Prog.mcu->adcCount; j++) { +// if(Prog.mcu->adcInfo[j].pin == Prog.mcu->pinInfo[i].pin) { +// // okay; we know how to connect it up to the ADC +// break; +// } +// } +// if(j == Prog.mcu->adcCount) { +// goto cant_use_this_io; +// } +// } + +// char buf[40]; +// if(Prog.mcu->pinCount <= 21) { +// sprintf(buf, "%3d %c%c%d", Prog.mcu->pinInfo[i].pin, +// Prog.mcu->portPrefix, Prog.mcu->pinInfo[i].port, +// Prog.mcu->pinInfo[i].bit); +// } else { +// sprintf(buf, "%3d %c%c%d", Prog.mcu->pinInfo[i].pin, +// Prog.mcu->portPrefix, Prog.mcu->pinInfo[i].port, +// Prog.mcu->pinInfo[i].bit); +// } +// SendMessage(PinList, LB_ADDSTRING, 0, (LPARAM)buf); +// cant_use_this_io:; +// } + +// EnableWindow(MainWindow, FALSE); +// ShowWindow(IoDialog, TRUE); +// SetFocus(PinList); + +// MSG msg; +// DWORD ret; +// DialogDone = FALSE; +// DialogCancel = FALSE; +// while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { +// if(msg.message == WM_KEYDOWN) { +// if(msg.wParam == VK_RETURN) { +// DialogDone = TRUE; +// break; +// } else if(msg.wParam == VK_ESCAPE) { +// DialogDone = TRUE; +// DialogCancel = TRUE; +// break; +// } +// } + +// if(IsDialogMessage(IoDialog, &msg)) continue; +// TranslateMessage(&msg); +// DispatchMessage(&msg); +// } + +// if(!DialogCancel) { +// int sel = SendMessage(PinList, LB_GETCURSEL, 0, 0); +// char pin[16]; +// SendMessage(PinList, LB_GETTEXT, (WPARAM)sel, (LPARAM)pin); +// if(strcmp(pin, _("(no pin)"))==0) { +// int i; +// for(i = 0; i < IoSeenPreviouslyCount; i++) { +// if(strcmp(IoSeenPreviously[i].name, +// Prog.io.assignment[item].name)==0) +// { +// IoSeenPreviously[i].pin = NO_PIN_ASSIGNED; +// } +// } +// Prog.io.assignment[item].pin = NO_PIN_ASSIGNED; +// } else { +// Prog.io.assignment[item].pin = atoi(pin); +// // Only one name can be bound to each pin; make sure that there's +// // not another entry for this pin in the IoSeenPreviously list, +// // that might get used if the user creates a new pin with that +// // name. +// int i; +// for(i = 0; i < IoSeenPreviouslyCount; i++) { +// if(IoSeenPreviously[i].pin == atoi(pin)) { +// IoSeenPreviously[i].pin = NO_PIN_ASSIGNED; +// } +// } +// } +// } + +// EnableWindow(MainWindow, TRUE); +// DestroyWindow(IoDialog); +// return; +// } //----------------------------------------------------------------------------- // Called in response to a notify for the listview. Handles click, text-edit @@ -767,119 +767,119 @@ cant_use_this_io:; // where (LPSTR_TEXTCALLBACK); that way we don't have two parallel copies of // the I/O list to keep in sync. //----------------------------------------------------------------------------- -void IoListProc(NMHDR *h) -{ - switch(h->code) { - case LVN_GETDISPINFO: { - NMLVDISPINFO *i = (NMLVDISPINFO *)h; - int item = i->item.iItem; - switch(i->item.iSubItem) { - case LV_IO_PIN: - // Don't confuse people by displaying bogus pin assignments - // for the C target. - if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || - Prog.mcu->whichIsa == ISA_INTERPRETED) ) - { - strcpy(i->item.pszText, ""); - break; - } - - PinNumberForIo(i->item.pszText, - &(Prog.io.assignment[item])); - break; - - case LV_IO_TYPE: { - char *s = IoTypeToString(Prog.io.assignment[item].type); - strcpy(i->item.pszText, s); - break; - } - case LV_IO_NAME: - strcpy(i->item.pszText, Prog.io.assignment[item].name); - break; - - case LV_IO_PORT: { - // Don't confuse people by displaying bogus pin assignments - // for the C target. - if(Prog.mcu && Prog.mcu->whichIsa == ISA_ANSIC) { - strcpy(i->item.pszText, ""); - break; - } - - int type = Prog.io.assignment[item].type; - if(type != IO_TYPE_DIG_INPUT && type != IO_TYPE_DIG_OUTPUT - && type != IO_TYPE_READ_ADC) - { - strcpy(i->item.pszText, ""); - break; - } - - int pin = Prog.io.assignment[item].pin; - if(pin == NO_PIN_ASSIGNED || !Prog.mcu) { - strcpy(i->item.pszText, ""); - break; - } - - if(UartFunctionUsed() && Prog.mcu) { - if((Prog.mcu->uartNeeds.rxPin == pin) || - (Prog.mcu->uartNeeds.txPin == pin)) - { - strcpy(i->item.pszText, _("<UART needs!>")); - break; - } - } - - if(PwmFunctionUsed() && Prog.mcu) { - if(Prog.mcu->pwmNeedsPin == pin) { - strcpy(i->item.pszText, _("<PWM needs!>")); - break; - } - } - - int j; - for(j = 0; j < Prog.mcu->pinCount; j++) { - if(Prog.mcu->pinInfo[j].pin == pin) { - sprintf(i->item.pszText, "%c%c%d", - Prog.mcu->portPrefix, - Prog.mcu->pinInfo[j].port, - Prog.mcu->pinInfo[j].bit); - break; - } - } - if(j == Prog.mcu->pinCount) { - sprintf(i->item.pszText, _("<not an I/O!>")); - } - break; - } - - case LV_IO_STATE: { - if(InSimulationMode) { - char *name = Prog.io.assignment[item].name; - DescribeForIoList(name, i->item.pszText); - } else { - strcpy(i->item.pszText, ""); - } - break; - } - - } - break; - } - case LVN_ITEMACTIVATE: { - NMITEMACTIVATE *i = (NMITEMACTIVATE *)h; - if(InSimulationMode) { - char *name = Prog.io.assignment[i->iItem].name; - if(name[0] == 'X') { - SimulationToggleContact(name); - } else if(name[0] == 'A') { - ShowAnalogSliderPopup(name); - } - } else { - UndoRemember(); - ShowIoDialog(i->iItem); - ProgramChanged(); - InvalidateRect(MainWindow, NULL, FALSE); - } - break; - } - } -} +// void IoListProc(NMHDR *h) +// { +// switch(h->code) { +// case LVN_GETDISPINFO: { +// NMLVDISPINFO *i = (NMLVDISPINFO *)h; +// int item = i->item.iItem; +// switch(i->item.iSubItem) { +// case LV_IO_PIN: +// // Don't confuse people by displaying bogus pin assignments +// // for the C target. +// if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || +// Prog.mcu->whichIsa == ISA_INTERPRETED) ) +// { +// strcpy(i->item.pszText, ""); +// break; +// } + +// PinNumberForIo(i->item.pszText, +// &(Prog.io.assignment[item])); +// break; + +// case LV_IO_TYPE: { +// char *s = IoTypeToString(Prog.io.assignment[item].type); +// strcpy(i->item.pszText, s); +// break; +// } +// case LV_IO_NAME: +// strcpy(i->item.pszText, Prog.io.assignment[item].name); +// break; + +// case LV_IO_PORT: { +// // Don't confuse people by displaying bogus pin assignments +// // for the C target. +// if(Prog.mcu && Prog.mcu->whichIsa == ISA_ANSIC) { +// strcpy(i->item.pszText, ""); +// break; +// } + +// int type = Prog.io.assignment[item].type; +// if(type != IO_TYPE_DIG_INPUT && type != IO_TYPE_DIG_OUTPUT +// && type != IO_TYPE_READ_ADC) +// { +// strcpy(i->item.pszText, ""); +// break; +// } + +// int pin = Prog.io.assignment[item].pin; +// if(pin == NO_PIN_ASSIGNED || !Prog.mcu) { +// strcpy(i->item.pszText, ""); +// break; +// } + +// if(UartFunctionUsed() && Prog.mcu) { +// if((Prog.mcu->uartNeeds.rxPin == pin) || +// (Prog.mcu->uartNeeds.txPin == pin)) +// { +// strcpy(i->item.pszText, _("<UART needs!>")); +// break; +// } +// } + +// if(PwmFunctionUsed() && Prog.mcu) { +// if(Prog.mcu->pwmNeedsPin == pin) { +// strcpy(i->item.pszText, _("<PWM needs!>")); +// break; +// } +// } + +// int j; +// for(j = 0; j < Prog.mcu->pinCount; j++) { +// if(Prog.mcu->pinInfo[j].pin == pin) { +// sprintf(i->item.pszText, "%c%c%d", +// Prog.mcu->portPrefix, +// Prog.mcu->pinInfo[j].port, +// Prog.mcu->pinInfo[j].bit); +// break; +// } +// } +// if(j == Prog.mcu->pinCount) { +// sprintf(i->item.pszText, _("<not an I/O!>")); +// } +// break; +// } + +// case LV_IO_STATE: { +// if(InSimulationMode) { +// char *name = Prog.io.assignment[item].name; +// DescribeForIoList(name, i->item.pszText); +// } else { +// strcpy(i->item.pszText, ""); +// } +// break; +// } + +// } +// break; +// } +// case LVN_ITEMACTIVATE: { +// NMITEMACTIVATE *i = (NMITEMACTIVATE *)h; +// if(InSimulationMode) { +// char *name = Prog.io.assignment[i->iItem].name; +// if(name[0] == 'X') { +// SimulationToggleContact(name); +// } else if(name[0] == 'A') { +// ShowAnalogSliderPopup(name); +// } +// } else { +// UndoRemember(); +// ShowIoDialog(i->iItem); +// ProgramChanged(); +// InvalidateRect(MainWindow, NULL, FALSE); +// } +// break; +// } +// } +// } diff --git a/ldmicro/lang.cpp b/ldmicro/lang.cpp index 4be05d0..67952bc 100644 --- a/ldmicro/lang.cpp +++ b/ldmicro/lang.cpp @@ -24,7 +24,7 @@ // table. If it fails then it just returns the English. // Jonathan Westhues, Apr 2007 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> @@ -42,7 +42,8 @@ typedef struct LangTag { // These are the actual translation tables, so should be included in just // one place. -#include "obj/lang-tables.h" +//#include "obj/lang-tables.h" +#define LDLANG_EN char *_(char *in) { diff --git a/ldmicro/ldinterpret.c b/ldmicro/ldinterpret.c index ce20dbc..6f18d44 100644 --- a/ldmicro/ldinterpret.c +++ b/ldmicro/ldinterpret.c @@ -36,7 +36,7 @@ //----------------------------------------------------------------------------- #include <stdio.h> #include <ctype.h> -#include <windows.h> +#include "linuxUI.h" #define INTCODE_H_CONSTANTS_ONLY #include "intcode.h" diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp index 8785753..67d9718 100644 --- a/ldmicro/ldmicro.cpp +++ b/ldmicro/ldmicro.cpp @@ -28,7 +28,6 @@ #include <stdio.h> #include <stdlib.h> - #include "ldmicro.h" #include "freezeLD.h" #include "mcutable.h" @@ -41,7 +40,7 @@ HDC Hdc; // parameters used to capture the mouse when implementing our totally non- // general splitter control -static HHOOK MouseHookHandle; +//static HHOOK MouseHookHandle; static int MouseY; // For the open/save dialog boxes @@ -67,75 +66,75 @@ PlcProgram Prog; // Get a filename with a common dialog box and then save the program to that // file and then set our default filename to that. //----------------------------------------------------------------------------- -static BOOL SaveAsDialog(void) -{ - OPENFILENAME ofn; - - memset(&ofn, 0, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hInstance = Instance; - ofn.lpstrFilter = LDMICRO_PATTERN; - ofn.lpstrDefExt = "ld"; - ofn.lpstrFile = CurrentSaveFile; - ofn.nMaxFile = sizeof(CurrentSaveFile); - ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; - - if(!GetSaveFileName(&ofn)) - return FALSE; - - if(!SaveProjectToFile(CurrentSaveFile)) { - Error(_("Couldn't write to '%s'."), CurrentSaveFile); - return FALSE; - } else { - ProgramChangedNotSaved = FALSE; - return TRUE; - } -} +// static BOOL SaveAsDialog(void) +// { +// OPENFILENAME ofn; + +// memset(&ofn, 0, sizeof(ofn)); +// ofn.lStructSize = sizeof(ofn); +// ofn.hInstance = Instance; +// ofn.lpstrFilter = LDMICRO_PATTERN; +// ofn.lpstrDefExt = "ld"; +// ofn.lpstrFile = CurrentSaveFile; +// ofn.nMaxFile = sizeof(CurrentSaveFile); +// ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + +// if(!GetSaveFileName(&ofn)) +// return FALSE; + +// if(!SaveProjectToFile(CurrentSaveFile)) { +// Error(_("Couldn't write to '%s'."), CurrentSaveFile); +// return FALSE; +// } else { +// ProgramChangedNotSaved = FALSE; +// return TRUE; +// } +// } //----------------------------------------------------------------------------- // Get a filename with a common dialog box and then export the program as // an ASCII art drawing. //----------------------------------------------------------------------------- -static void ExportDialog(void) -{ - char exportFile[MAX_PATH]; - OPENFILENAME ofn; +// static void ExportDialog(void) +// { +// char exportFile[MAX_PATH]; +// OPENFILENAME ofn; - exportFile[0] = '\0'; +// exportFile[0] = '\0'; - memset(&ofn, 0, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hInstance = Instance; - ofn.lpstrFilter = TXT_PATTERN; - ofn.lpstrFile = exportFile; - ofn.lpstrTitle = _("Export As Text"); - ofn.nMaxFile = sizeof(exportFile); - ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; +// memset(&ofn, 0, sizeof(ofn)); +// ofn.lStructSize = sizeof(ofn); +// ofn.hInstance = Instance; +// ofn.lpstrFilter = TXT_PATTERN; +// ofn.lpstrFile = exportFile; +// ofn.lpstrTitle = _("Export As Text"); +// ofn.nMaxFile = sizeof(exportFile); +// ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; - if(!GetSaveFileName(&ofn)) - return; +// if(!GetSaveFileName(&ofn)) +// return; - ExportDrawingAsText(exportFile); -} +// ExportDrawingAsText(exportFile); +// } //----------------------------------------------------------------------------- // If we already have a filename, save the program to that. Otherwise same // as Save As. Returns TRUE if it worked, else returns FALSE. //----------------------------------------------------------------------------- -static BOOL SaveProgram(void) -{ - if(strlen(CurrentSaveFile)) { - if(!SaveProjectToFile(CurrentSaveFile)) { - Error(_("Couldn't write to '%s'."), CurrentSaveFile); - return FALSE; - } else { - ProgramChangedNotSaved = FALSE; - return TRUE; - } - } else { - return SaveAsDialog(); - } -} +// static BOOL SaveProgram(void) +// { +// if(strlen(CurrentSaveFile)) { +// if(!SaveProjectToFile(CurrentSaveFile)) { +// Error(_("Couldn't write to '%s'."), CurrentSaveFile); +// return FALSE; +// } else { +// ProgramChangedNotSaved = FALSE; +// return TRUE; +// } +// } else { +// return SaveAsDialog(); +// } +// } //----------------------------------------------------------------------------- // Compile the program to a hex file for the target micro. Get the output @@ -205,92 +204,92 @@ static void CompileProgram(BOOL compileAs) // or to cancel the operation they are performing. Return TRUE if they want // to cancel. //----------------------------------------------------------------------------- -BOOL CheckSaveUserCancels(void) -{ - if(!ProgramChangedNotSaved) { - // no problem - return FALSE; - } - - int r = MessageBox(MainWindow, - _("The program has changed since it was last saved.\r\n\r\n" - "Do you want to save the changes?"), "LDmicro", - MB_YESNOCANCEL | MB_ICONWARNING); - switch(r) { - case IDYES: - if(SaveProgram()) - return FALSE; - else - return TRUE; - - case IDNO: - return FALSE; - - case IDCANCEL: - return TRUE; - - default: - oops(); - } -} +// BOOL CheckSaveUserCancels(void) +// { +// if(!ProgramChangedNotSaved) { +// // no problem +// return FALSE; +// } + +// int r = MessageBox(MainWindow, +// _("The program has changed since it was last saved.\r\n\r\n" +// "Do you want to save the changes?"), "LDmicro", +// MB_YESNOCANCEL | MB_ICONWARNING); +// switch(r) { +// case IDYES: +// if(SaveProgram()) +// return FALSE; +// else +// return TRUE; + +// case IDNO: +// return FALSE; + +// case IDCANCEL: +// return TRUE; + +// default: +// oops(); +// } +// } //----------------------------------------------------------------------------- // Load a new program from a file. If it succeeds then set our default filename // to that, else we end up with an empty file then. //----------------------------------------------------------------------------- -static void OpenDialog(void) -{ - OPENFILENAME ofn; - - char tempSaveFile[MAX_PATH] = ""; - - memset(&ofn, 0, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hInstance = Instance; - ofn.lpstrFilter = LDMICRO_PATTERN; - ofn.lpstrDefExt = "ld"; - ofn.lpstrFile = tempSaveFile; - ofn.nMaxFile = sizeof(tempSaveFile); - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(!GetOpenFileName(&ofn)) - return; - - if(!LoadProjectFromFile(tempSaveFile)) { - Error(_("Couldn't open '%s'."), tempSaveFile); - CurrentSaveFile[0] = '\0'; - } else { - ProgramChangedNotSaved = FALSE; - strcpy(CurrentSaveFile, tempSaveFile); - UndoFlush(); - } - - GenerateIoListDontLoseSelection(); - RefreshScrollbars(); - UpdateMainWindowTitleBar(); -} +// static void OpenDialog(void) +// { +// OPENFILENAME ofn; + +// char tempSaveFile[MAX_PATH] = ""; + +// memset(&ofn, 0, sizeof(ofn)); +// ofn.lStructSize = sizeof(ofn); +// ofn.hInstance = Instance; +// ofn.lpstrFilter = LDMICRO_PATTERN; +// ofn.lpstrDefExt = "ld"; +// ofn.lpstrFile = tempSaveFile; +// ofn.nMaxFile = sizeof(tempSaveFile); +// ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + +// if(!GetOpenFileName(&ofn)) +// return; + +// if(!LoadProjectFromFile(tempSaveFile)) { +// Error(_("Couldn't open '%s'."), tempSaveFile); +// CurrentSaveFile[0] = '\0'; +// } else { +// ProgramChangedNotSaved = FALSE; +// strcpy(CurrentSaveFile, tempSaveFile); +// UndoFlush(); +// } + +// GenerateIoListDontLoseSelection(); +// RefreshScrollbars(); +// UpdateMainWindowTitleBar(); +// } //----------------------------------------------------------------------------- // Housekeeping required when the program changes: mark the program as // changed so that we ask if user wants to save before exiting, and update // the I/O list. //----------------------------------------------------------------------------- -void ProgramChanged(void) -{ - ProgramChangedNotSaved = TRUE; - GenerateIoListDontLoseSelection(); - RefreshScrollbars(); - if(AdvancedWindowOpen) - { - FlushPinNames(); - PopulateNamingList(); - } -} -#define CHANGING_PROGRAM(x) { \ - UndoRemember(); \ - x; \ - ProgramChanged(); \ - } +// void ProgramChanged(void) +// { +// ProgramChangedNotSaved = TRUE; +// GenerateIoListDontLoseSelection(); +// RefreshScrollbars(); +// if(AdvancedWindowOpen) +// { +// FlushPinNames(); +// PopulateNamingList(); +// } +// } +// #define CHANGING_PROGRAM(x) { \ +// UndoRemember(); \ +// x; \ +// ProgramChanged(); \ +// } //----------------------------------------------------------------------------- // Hook that we install when the user starts dragging the `splitter,' in case @@ -298,786 +297,815 @@ void ProgramChanged(void) // the listview in response to mouse move, and unhook ourselves when they // release the mouse button. //----------------------------------------------------------------------------- -static LRESULT CALLBACK MouseHook(int code, WPARAM wParam, LPARAM lParam) -{ - switch(code) { - case HC_ACTION: { - MSLLHOOKSTRUCT *mhs = (MSLLHOOKSTRUCT *)lParam; - - switch(wParam) { - case WM_MOUSEMOVE: { - int dy = MouseY - mhs->pt.y; +// static LRESULT CALLBACK MouseHook(int code, WPARAM wParam, LPARAM lParam) +// { +// switch(code) { +// case HC_ACTION: { +// MSLLHOOKSTRUCT *mhs = (MSLLHOOKSTRUCT *)lParam; + +// switch(wParam) { +// case WM_MOUSEMOVE: { +// int dy = MouseY - mhs->pt.y; - IoListHeight += dy; - if(IoListHeight < 50) IoListHeight = 50; - MouseY = mhs->pt.y; - MainWindowResized(); - - break; - } - - case WM_LBUTTONUP: - UnhookWindowsHookEx(MouseHookHandle); - break; - } - break; - } - } - return CallNextHookEx(MouseHookHandle, code, wParam, lParam); -} +// IoListHeight += dy; +// if(IoListHeight < 50) IoListHeight = 50; +// MouseY = mhs->pt.y; +// MainWindowResized(); + +// break; +// } + +// case WM_LBUTTONUP: +// UnhookWindowsHookEx(MouseHookHandle); +// break; +// } +// break; +// } +// } +// return CallNextHookEx(MouseHookHandle, code, wParam, lParam); +// } //----------------------------------------------------------------------------- // Handle a selection from the menu bar of the main window. //----------------------------------------------------------------------------- -static void ProcessMenu(int code) -{ - if(code >= MNU_PROCESSOR_0 && code < MNU_PROCESSOR_0+NUM_SUPPORTED_MCUS) { - strcpy(CurrentCompileFile, ""); - Prog.mcu = &SupportedMcus[code - MNU_PROCESSOR_0]; - RefreshControlsToSettings(); - return; - } - if(code == MNU_PROCESSOR_0+NUM_SUPPORTED_MCUS) { - Prog.mcu = NULL; - strcpy(CurrentCompileFile, ""); - RefreshControlsToSettings(); - return; - } - - switch(code) { - case MNU_NEW: - if(CheckSaveUserCancels()) break; - NewProgram(); - strcpy(CurrentSaveFile, ""); - strcpy(CurrentCompileFile, ""); - GenerateIoListDontLoseSelection(); - RefreshScrollbars(); - UpdateMainWindowTitleBar(); - break; - - case MNU_OPEN: - if(CheckSaveUserCancels()) break; - OpenDialog(); - break; - - case MNU_SAVE: - SaveProgram(); - UpdateMainWindowTitleBar(); - break; - - case MNU_SAVE_AS: - SaveAsDialog(); - UpdateMainWindowTitleBar(); - break; - - case MNU_EXPORT: - ExportDialog(); - break; - - case MNU_EXIT: - if(CheckSaveUserCancels()) break; - PostQuitMessage(0); - break; - - case MNU_INSERT_COMMENT: - CHANGING_PROGRAM(AddComment(_("--add comment here--"))); - break; - - case MNU_INSERT_CONTACTS: - CHANGING_PROGRAM(AddContact()); - break; - - case MNU_INSERT_COIL: - CHANGING_PROGRAM(AddCoil()); - break; - - case MNU_INSERT_TON: - CHANGING_PROGRAM(AddTimer(ELEM_TON)); - break; - - case MNU_INSERT_TOF: - CHANGING_PROGRAM(AddTimer(ELEM_TOF)); - break; - - case MNU_INSERT_RTO: - CHANGING_PROGRAM(AddTimer(ELEM_RTO)); - break; - - case MNU_INSERT_CTU: - CHANGING_PROGRAM(AddCounter(ELEM_CTU)); - break; - - case MNU_INSERT_CTD: - CHANGING_PROGRAM(AddCounter(ELEM_CTD)); - break; - - case MNU_INSERT_CTC: - CHANGING_PROGRAM(AddCounter(ELEM_CTC)); - break; - - case MNU_INSERT_RES: - CHANGING_PROGRAM(AddReset()); - break; - - case MNU_INSERT_OPEN: - CHANGING_PROGRAM(AddEmpty(ELEM_OPEN)); - break; - - case MNU_INSERT_SHORT: - CHANGING_PROGRAM(AddEmpty(ELEM_SHORT)); - break; - - case MNU_INSERT_MASTER_RLY: - CHANGING_PROGRAM(AddMasterRelay()); - break; - - case MNU_INSERT_SHIFT_REG: - CHANGING_PROGRAM(AddShiftRegister()); - break; - - case MNU_INSERT_LUT: - CHANGING_PROGRAM(AddLookUpTable()); - break; +// static void ProcessMenu(int code) +// { +// if(code >= MNU_PROCESSOR_0 && code < MNU_PROCESSOR_0+NUM_SUPPORTED_MCUS) { +// strcpy(CurrentCompileFile, ""); +// Prog.mcu = &SupportedMcus[code - MNU_PROCESSOR_0]; +// RefreshControlsToSettings(); +// return; +// } +// if(code == MNU_PROCESSOR_0+NUM_SUPPORTED_MCUS) { +// Prog.mcu = NULL; +// strcpy(CurrentCompileFile, ""); +// RefreshControlsToSettings(); +// return; +// } + +// switch(code) { +// case MNU_NEW: +// if(CheckSaveUserCancels()) break; +// NewProgram(); +// strcpy(CurrentSaveFile, ""); +// strcpy(CurrentCompileFile, ""); +// GenerateIoListDontLoseSelection(); +// RefreshScrollbars(); +// UpdateMainWindowTitleBar(); +// break; + +// case MNU_OPEN: +// if(CheckSaveUserCancels()) break; +// OpenDialog(); +// break; + +// case MNU_SAVE: +// SaveProgram(); +// UpdateMainWindowTitleBar(); +// break; + +// case MNU_SAVE_AS: +// SaveAsDialog(); +// UpdateMainWindowTitleBar(); +// break; + +// case MNU_EXPORT: +// ExportDialog(); +// break; + +// case MNU_EXIT: +// if(CheckSaveUserCancels()) break; +// PostQuitMessage(0); +// break; + +// case MNU_INSERT_COMMENT: +// CHANGING_PROGRAM(AddComment(_("--add comment here--"))); +// break; + +// case MNU_INSERT_CONTACTS: +// CHANGING_PROGRAM(AddContact()); +// break; + +// case MNU_INSERT_COIL: +// CHANGING_PROGRAM(AddCoil()); +// break; + +// case MNU_INSERT_TON: +// CHANGING_PROGRAM(AddTimer(ELEM_TON)); +// break; + +// case MNU_INSERT_TOF: +// CHANGING_PROGRAM(AddTimer(ELEM_TOF)); +// break; + +// case MNU_INSERT_RTO: +// CHANGING_PROGRAM(AddTimer(ELEM_RTO)); +// break; + +// case MNU_INSERT_CTU: +// CHANGING_PROGRAM(AddCounter(ELEM_CTU)); +// break; + +// case MNU_INSERT_CTD: +// CHANGING_PROGRAM(AddCounter(ELEM_CTD)); +// break; + +// case MNU_INSERT_CTC: +// CHANGING_PROGRAM(AddCounter(ELEM_CTC)); +// break; + +// case MNU_INSERT_RES: +// CHANGING_PROGRAM(AddReset()); +// break; + +// case MNU_INSERT_OPEN: +// CHANGING_PROGRAM(AddEmpty(ELEM_OPEN)); +// break; + +// case MNU_INSERT_SHORT: +// CHANGING_PROGRAM(AddEmpty(ELEM_SHORT)); +// break; + +// case MNU_INSERT_MASTER_RLY: +// CHANGING_PROGRAM(AddMasterRelay()); +// break; + +// case MNU_INSERT_SHIFT_REG: +// CHANGING_PROGRAM(AddShiftRegister()); +// break; + +// case MNU_INSERT_LUT: +// CHANGING_PROGRAM(AddLookUpTable()); +// break; - case MNU_INSERT_PWL: - CHANGING_PROGRAM(AddPiecewiseLinear()); - break; +// case MNU_INSERT_PWL: +// CHANGING_PROGRAM(AddPiecewiseLinear()); +// break; - case MNU_INSERT_FMTD_STR: - CHANGING_PROGRAM(AddFormattedString()); - break; - - case MNU_INSERT_OSR: - CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_RISING)); - break; - - case MNU_INSERT_OSF: - CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_FALLING)); - break; - - case MNU_INSERT_MOV: - CHANGING_PROGRAM(AddMove()); - break; - - case MNU_INSERT_SET_PWM: - CHANGING_PROGRAM(AddSetPwm()); - break; - - case MNU_INSERT_READ_ADC: - CHANGING_PROGRAM(AddReadAdc()); - break; - - case MNU_INSERT_UART_SEND: - CHANGING_PROGRAM(AddUart(ELEM_UART_SEND)); - break; - - case MNU_INSERT_UART_RECV: - CHANGING_PROGRAM(AddUart(ELEM_UART_RECV)); - break; - - case MNU_INSERT_PERSIST: - CHANGING_PROGRAM(AddPersist()); - break; - - { - int elem; - case MNU_INSERT_ADD: elem = ELEM_ADD; goto math; - case MNU_INSERT_SUB: elem = ELEM_SUB; goto math; - case MNU_INSERT_MUL: elem = ELEM_MUL; goto math; - case MNU_INSERT_DIV: elem = ELEM_DIV; goto math; -math: - CHANGING_PROGRAM(AddMath(elem)); - break; - } - - { - int elem; - case MNU_INSERT_EQU: elem = ELEM_EQU; goto cmp; - case MNU_INSERT_NEQ: elem = ELEM_NEQ; goto cmp; - case MNU_INSERT_GRT: elem = ELEM_GRT; goto cmp; - case MNU_INSERT_GEQ: elem = ELEM_GEQ; goto cmp; - case MNU_INSERT_LES: elem = ELEM_LES; goto cmp; - case MNU_INSERT_LEQ: elem = ELEM_LEQ; goto cmp; -cmp: - CHANGING_PROGRAM(AddCmp(elem)); - break; - } - - case MNU_MAKE_NORMAL: - CHANGING_PROGRAM(MakeNormalSelected()); - break; - - case MNU_NEGATE: - CHANGING_PROGRAM(NegateSelected()); - break; - - case MNU_MAKE_SET_ONLY: - CHANGING_PROGRAM(MakeSetOnlySelected()); - break; - - case MNU_MAKE_RESET_ONLY: - CHANGING_PROGRAM(MakeResetOnlySelected()); - break; - - case MNU_UNDO: - UndoUndo(); - break; - - case MNU_REDO: - UndoRedo(); - break; - - case MNU_INSERT_RUNG_BEFORE: - CHANGING_PROGRAM(InsertRung(FALSE)); - break; - - case MNU_INSERT_RUNG_AFTER: - CHANGING_PROGRAM(InsertRung(TRUE)); - break; - - case MNU_DELETE_RUNG: - CHANGING_PROGRAM(DeleteSelectedRung()); - break; - - case MNU_PUSH_RUNG_UP: - CHANGING_PROGRAM(PushRungUp()); - break; - - case MNU_PUSH_RUNG_DOWN: - CHANGING_PROGRAM(PushRungDown()); - break; - - case MNU_DELETE_ELEMENT: - CHANGING_PROGRAM(DeleteSelectedFromProgram()); - break; - - case MNU_MCU_SETTINGS: - CHANGING_PROGRAM(ShowConfDialog()); - break; - - case MNU_SIMULATION_MODE: - ToggleSimulationMode(); - ToggleAdvancedSimulationMode(); - break; - - case MNU_START_SIMULATION: - StartSimulation(); - StartAdvSimulation(); - break; - - case MNU_STOP_SIMULATION: - StopSimulation(); - StopAdvSimulation(); - break; - - case MNU_SINGLE_CYCLE: - SimulateOneCycle(TRUE); - break; - - case MNU_COMPILE: - CompileProgram(FALSE); - break; - - case MNU_COMPILE_AS: - CompileProgram(TRUE); - break; - - case MNU_MANUAL: - ShowHelpDialog(FALSE); - break; - - case MNU_ABOUT: - ShowHelpDialog(TRUE); - break; - - case MNU_ADV_SIMULATION: - ShowAdvancedDialog(); - } -} +// case MNU_INSERT_FMTD_STR: +// CHANGING_PROGRAM(AddFormattedString()); +// break; + +// case MNU_INSERT_OSR: +// CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_RISING)); +// break; + +// case MNU_INSERT_OSF: +// CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_FALLING)); +// break; + +// case MNU_INSERT_MOV: +// CHANGING_PROGRAM(AddMove()); +// break; + +// case MNU_INSERT_SET_PWM: +// CHANGING_PROGRAM(AddSetPwm()); +// break; + +// case MNU_INSERT_READ_ADC: +// CHANGING_PROGRAM(AddReadAdc()); +// break; + +// case MNU_INSERT_UART_SEND: +// CHANGING_PROGRAM(AddUart(ELEM_UART_SEND)); +// break; + +// case MNU_INSERT_UART_RECV: +// CHANGING_PROGRAM(AddUart(ELEM_UART_RECV)); +// break; + +// case MNU_INSERT_PERSIST: +// CHANGING_PROGRAM(AddPersist()); +// break; + +// { +// int elem; +// case MNU_INSERT_ADD: elem = ELEM_ADD; goto math; +// case MNU_INSERT_SUB: elem = ELEM_SUB; goto math; +// case MNU_INSERT_MUL: elem = ELEM_MUL; goto math; +// case MNU_INSERT_DIV: elem = ELEM_DIV; goto math; +// math: +// CHANGING_PROGRAM(AddMath(elem)); +// break; +// } + +// { +// int elem; +// case MNU_INSERT_EQU: elem = ELEM_EQU; goto cmp; +// case MNU_INSERT_NEQ: elem = ELEM_NEQ; goto cmp; +// case MNU_INSERT_GRT: elem = ELEM_GRT; goto cmp; +// case MNU_INSERT_GEQ: elem = ELEM_GEQ; goto cmp; +// case MNU_INSERT_LES: elem = ELEM_LES; goto cmp; +// case MNU_INSERT_LEQ: elem = ELEM_LEQ; goto cmp; +// cmp: +// CHANGING_PROGRAM(AddCmp(elem)); +// break; +// } + +// case MNU_MAKE_NORMAL: +// CHANGING_PROGRAM(MakeNormalSelected()); +// break; + +// case MNU_NEGATE: +// CHANGING_PROGRAM(NegateSelected()); +// break; + +// case MNU_MAKE_SET_ONLY: +// CHANGING_PROGRAM(MakeSetOnlySelected()); +// break; + +// case MNU_MAKE_RESET_ONLY: +// CHANGING_PROGRAM(MakeResetOnlySelected()); +// break; + +// case MNU_UNDO: +// UndoUndo(); +// break; + +// case MNU_REDO: +// UndoRedo(); +// break; + +// case MNU_INSERT_RUNG_BEFORE: +// CHANGING_PROGRAM(InsertRung(FALSE)); +// break; + +// case MNU_INSERT_RUNG_AFTER: +// CHANGING_PROGRAM(InsertRung(TRUE)); +// break; + +// case MNU_DELETE_RUNG: +// CHANGING_PROGRAM(DeleteSelectedRung()); +// break; + +// case MNU_PUSH_RUNG_UP: +// CHANGING_PROGRAM(PushRungUp()); +// break; + +// case MNU_PUSH_RUNG_DOWN: +// CHANGING_PROGRAM(PushRungDown()); +// break; + +// case MNU_DELETE_ELEMENT: +// CHANGING_PROGRAM(DeleteSelectedFromProgram()); +// break; + +// case MNU_MCU_SETTINGS: +// CHANGING_PROGRAM(ShowConfDialog()); +// break; + +// case MNU_SIMULATION_MODE: +// ToggleSimulationMode(); +// ToggleAdvancedSimulationMode(); +// break; + +// case MNU_START_SIMULATION: +// StartSimulation(); +// StartAdvSimulation(); +// break; + +// case MNU_STOP_SIMULATION: +// StopSimulation(); +// StopAdvSimulation(); +// break; + +// case MNU_SINGLE_CYCLE: +// SimulateOneCycle(TRUE); +// break; + +// case MNU_COMPILE: +// CompileProgram(FALSE); +// break; + +// case MNU_COMPILE_AS: +// CompileProgram(TRUE); +// break; + +// case MNU_MANUAL: +// ShowHelpDialog(FALSE); +// break; + +// case MNU_ABOUT: +// ShowHelpDialog(TRUE); +// break; + +// case MNU_ADV_SIMULATION: +// ShowAdvancedDialog(); +// } +// } //----------------------------------------------------------------------------- // WndProc for MainWindow. //----------------------------------------------------------------------------- -LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_ERASEBKGND: - break; - - case WM_SETFOCUS: - InvalidateRect(MainWindow, NULL, FALSE); - break; - - case WM_PAINT: { - PAINTSTRUCT ps; - Hdc = BeginPaint(hwnd, &ps); - - // This draws the schematic. - PaintWindow(); - - RECT r; - // Fill around the scroll bars - if(NeedHoriz) { - r.top = IoListTop - ScrollHeight - 2; - r.bottom = IoListTop - 2; - FillRect(Hdc, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH)); - } - GetClientRect(MainWindow, &r); - r.left = r.right - ScrollWidth - 2; - FillRect(Hdc, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH)); - - // Draw the splitter thing to grab to resize the I/O listview. - GetClientRect(MainWindow, &r); - r.top = IoListTop - 2; - r.bottom = IoListTop; - FillRect(Hdc, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH)); - r.top = IoListTop - 2; - r.bottom = IoListTop - 1; - FillRect(Hdc, &r, (HBRUSH)GetStockObject(WHITE_BRUSH)); - r.top = IoListTop; - r.bottom = IoListTop + 1; - FillRect(Hdc, &r, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); - - EndPaint(hwnd, &ps); - return 1; - } - - case WM_KEYDOWN: { - if(wParam == 'M') { - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - ToggleSimulationMode(); - ToggleAdvancedSimulationMode(); - break; - } - } else if(wParam == VK_TAB) { - SetFocus(IoList); - BlinkCursor(0, 0, 0, 0); - break; - } else if(wParam == VK_F1) { - ShowHelpDialog(FALSE); - break; - } - - if(wParam == 'A') { - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - ShowAdvancedDialog(); - break; - } - } - - if(InSimulationMode) { - switch(wParam) { - case ' ': - SimulateOneCycle(TRUE); - break; - - case 'R': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) - StartSimulation(); - StartAdvSimulation(); - break; - - case 'H': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) - StopSimulation(); - StopAdvSimulation(); - break; - - case VK_DOWN: - if(ScrollYOffset < ScrollYOffsetMax) - ScrollYOffset++; - RefreshScrollbars(); - InvalidateRect(MainWindow, NULL, FALSE); - break; - - case VK_UP: - if(ScrollYOffset > 0) - ScrollYOffset--; - RefreshScrollbars(); - InvalidateRect(MainWindow, NULL, FALSE); - break; - - case VK_LEFT: - ScrollXOffset -= FONT_WIDTH; - if(ScrollXOffset < 0) ScrollXOffset = 0; - RefreshScrollbars(); - InvalidateRect(MainWindow, NULL, FALSE); - break; - - case VK_RIGHT: - ScrollXOffset += FONT_WIDTH; - if(ScrollXOffset >= ScrollXOffsetMax) - ScrollXOffset = ScrollXOffsetMax; - RefreshScrollbars(); - InvalidateRect(MainWindow, NULL, FALSE); - break; - - case VK_RETURN: - case VK_ESCAPE: - ToggleSimulationMode(); - break; - } - break; - } - - switch(wParam) { - case VK_F5: - CompileProgram(FALSE); - break; - - case VK_UP: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(PushRungUp()); - } else { - MoveCursorKeyboard(wParam); - } - break; - - case VK_DOWN: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(PushRungDown()); - } else { - MoveCursorKeyboard(wParam); - } - break; - - case VK_RIGHT: - case VK_LEFT: - MoveCursorKeyboard(wParam); - break; - - case VK_RETURN: - CHANGING_PROGRAM(EditSelectedElement()); - break; - - case VK_DELETE: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(DeleteSelectedRung()); - } else { - CHANGING_PROGRAM(DeleteSelectedFromProgram()); - } - break; - - case VK_OEM_1: - CHANGING_PROGRAM(AddComment(_("--add comment here--"))); - break; - - case 'C': - CHANGING_PROGRAM(AddContact()); - break; - - // TODO: rather country-specific here - case VK_OEM_2: - CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_RISING)); - break; - - case VK_OEM_5: - CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_FALLING)); - break; - - case 'L': - CHANGING_PROGRAM(AddCoil()); - break; - - case 'R': - CHANGING_PROGRAM(MakeResetOnlySelected()); - break; - - case 'E': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - ExportDialog(); - } else { - CHANGING_PROGRAM(AddReset()); - } - break; - - case 'S': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - SaveProgram(); - UpdateMainWindowTitleBar(); - } else { - CHANGING_PROGRAM(MakeSetOnlySelected()); - } - break; - - case 'N': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - if(CheckSaveUserCancels()) break; - if(!ProgramChangedNotSaved) { - int r = MessageBox(MainWindow, - _("Start new program?"), - "LDmicro", MB_YESNO | MB_DEFBUTTON2 | - MB_ICONQUESTION); - if(r == IDNO) break; - } - NewProgram(); - strcpy(CurrentSaveFile, ""); - strcpy(CurrentCompileFile, ""); - GenerateIoListDontLoseSelection(); - RefreshScrollbars(); - UpdateMainWindowTitleBar(); - } else { - CHANGING_PROGRAM(NegateSelected()); - } - break; - - case 'A': - CHANGING_PROGRAM(MakeNormalSelected()); - break; - - case 'T': - CHANGING_PROGRAM(AddTimer(ELEM_RTO)); - break; - - case 'O': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - if(CheckSaveUserCancels()) break; - OpenDialog(); - } else { - CHANGING_PROGRAM(AddTimer(ELEM_TON)); - } - break; - - case 'F': - CHANGING_PROGRAM(AddTimer(ELEM_TOF)); - break; - - case 'U': - CHANGING_PROGRAM(AddCounter(ELEM_CTU)); - break; - - case 'I': - CHANGING_PROGRAM(AddCounter(ELEM_CTD)); - break; - - case 'J': - CHANGING_PROGRAM(AddCounter(ELEM_CTC)); - break; - - case 'M': - CHANGING_PROGRAM(AddMove()); - break; - - case 'P': - CHANGING_PROGRAM(AddReadAdc()); - break; - - case VK_OEM_PLUS: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(AddMath(ELEM_ADD)); - } else { - CHANGING_PROGRAM(AddCmp(ELEM_EQU)); - } - break; - - case VK_OEM_MINUS: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - } else { - CHANGING_PROGRAM(AddMath(ELEM_SUB)); - } - break; - - case '8': - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(AddMath(ELEM_MUL)); - } - break; - - case 'D': - CHANGING_PROGRAM(AddMath(ELEM_DIV)); - break; - - case VK_OEM_PERIOD: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(AddCmp(ELEM_GRT)); - } else { - CHANGING_PROGRAM(AddCmp(ELEM_GEQ)); - } - break; - - case VK_OEM_COMMA: - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(AddCmp(ELEM_LES)); - } else { - CHANGING_PROGRAM(AddCmp(ELEM_LEQ)); - } - break; - - case 'V': - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(InsertRung(TRUE)); - } - break; - - case '6': - if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { - CHANGING_PROGRAM(InsertRung(FALSE)); - } - break; - - case 'Z': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - UndoUndo(); - } - break; - - case 'Y': - if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { - UndoRedo(); - } - break; - - default: - break; - } - if(wParam != VK_SHIFT && wParam != VK_CONTROL) { - InvalidateRect(MainWindow, NULL, FALSE); - } - break; - } - - case WM_LBUTTONDBLCLK: { - int x = LOWORD(lParam); - int y = HIWORD(lParam); - if(InSimulationMode) { - EditElementMouseDoubleclick(x, y); - } else { - CHANGING_PROGRAM(EditElementMouseDoubleclick(x, y)); - } - InvalidateRect(MainWindow, NULL, FALSE); - break; - } - - case WM_LBUTTONDOWN: { - int x = LOWORD(lParam); - int y = HIWORD(lParam); - if((y > (IoListTop - 9)) && (y < (IoListTop + 3))) { - POINT pt; - pt.x = x; pt.y = y; - ClientToScreen(MainWindow, &pt); - MouseY = pt.y; - MouseHookHandle = SetWindowsHookEx(WH_MOUSE_LL, - (HOOKPROC)MouseHook, Instance, 0); - } - if(!InSimulationMode) MoveCursorMouseClick(x, y); - - SetFocus(MainWindow); - InvalidateRect(MainWindow, NULL, FALSE); - break; - } - case WM_MOUSEMOVE: { - int x = LOWORD(lParam); - int y = HIWORD(lParam); - - if((y > (IoListTop - 9)) && (y < (IoListTop + 3))) { - SetCursor(LoadCursor(NULL, IDC_SIZENS)); - } else { - SetCursor(LoadCursor(NULL, IDC_ARROW)); - } +// LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +// { +// switch (msg) { +// case WM_ERASEBKGND: +// break; + +// case WM_SETFOCUS: +// InvalidateRect(MainWindow, NULL, FALSE); +// break; + +// case WM_PAINT: { +// PAINTSTRUCT ps; +// Hdc = BeginPaint(hwnd, &ps); + +// // This draws the schematic. +// PaintWindow(); + +// RECT r; +// // Fill around the scroll bars +// if(NeedHoriz) { +// r.top = IoListTop - ScrollHeight - 2; +// r.bottom = IoListTop - 2; +// FillRect(Hdc, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH)); +// } +// GetClientRect(MainWindow, &r); +// r.left = r.right - ScrollWidth - 2; +// FillRect(Hdc, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH)); + +// // Draw the splitter thing to grab to resize the I/O listview. +// GetClientRect(MainWindow, &r); +// r.top = IoListTop - 2; +// r.bottom = IoListTop; +// FillRect(Hdc, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH)); +// r.top = IoListTop - 2; +// r.bottom = IoListTop - 1; +// FillRect(Hdc, &r, (HBRUSH)GetStockObject(WHITE_BRUSH)); +// r.top = IoListTop; +// r.bottom = IoListTop + 1; +// FillRect(Hdc, &r, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + +// EndPaint(hwnd, &ps); +// return 1; +// } + +// case WM_KEYDOWN: { +// if(wParam == 'M') { +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// ToggleSimulationMode(); +// ToggleAdvancedSimulationMode(); +// break; +// } +// } else if(wParam == VK_TAB) { +// SetFocus(IoList); +// BlinkCursor(0, 0, 0, 0); +// break; +// } else if(wParam == VK_F1) { +// ShowHelpDialog(FALSE); +// break; +// } + +// if(wParam == 'A') { +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// ShowAdvancedDialog(); +// break; +// } +// } + +// if(InSimulationMode) { +// switch(wParam) { +// case ' ': +// SimulateOneCycle(TRUE); +// break; + +// case 'R': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) +// StartSimulation(); +// StartAdvSimulation(); +// break; + +// case 'H': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) +// StopSimulation(); +// StopAdvSimulation(); +// break; + +// case VK_DOWN: +// if(ScrollYOffset < ScrollYOffsetMax) +// ScrollYOffset++; +// RefreshScrollbars(); +// InvalidateRect(MainWindow, NULL, FALSE); +// break; + +// case VK_UP: +// if(ScrollYOffset > 0) +// ScrollYOffset--; +// RefreshScrollbars(); +// InvalidateRect(MainWindow, NULL, FALSE); +// break; + +// case VK_LEFT: +// ScrollXOffset -= FONT_WIDTH; +// if(ScrollXOffset < 0) ScrollXOffset = 0; +// RefreshScrollbars(); +// InvalidateRect(MainWindow, NULL, FALSE); +// break; + +// case VK_RIGHT: +// ScrollXOffset += FONT_WIDTH; +// if(ScrollXOffset >= ScrollXOffsetMax) +// ScrollXOffset = ScrollXOffsetMax; +// RefreshScrollbars(); +// InvalidateRect(MainWindow, NULL, FALSE); +// break; + +// case VK_RETURN: +// case VK_ESCAPE: +// ToggleSimulationMode(); +// break; +// } +// break; +// } + +// switch(wParam) { +// case VK_F5: +// CompileProgram(FALSE); +// break; + +// case VK_UP: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(PushRungUp()); +// } else { +// MoveCursorKeyboard(wParam); +// } +// break; + +// case VK_DOWN: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(PushRungDown()); +// } else { +// MoveCursorKeyboard(wParam); +// } +// break; + +// case VK_RIGHT: +// case VK_LEFT: +// MoveCursorKeyboard(wParam); +// break; + +// case VK_RETURN: +// CHANGING_PROGRAM(EditSelectedElement()); +// break; + +// case VK_DELETE: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(DeleteSelectedRung()); +// } else { +// CHANGING_PROGRAM(DeleteSelectedFromProgram()); +// } +// break; + +// case VK_OEM_1: +// CHANGING_PROGRAM(AddComment(_("--add comment here--"))); +// break; + +// case 'C': +// CHANGING_PROGRAM(AddContact()); +// break; + +// // TODO: rather country-specific here +// case VK_OEM_2: +// CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_RISING)); +// break; + +// case VK_OEM_5: +// CHANGING_PROGRAM(AddEmpty(ELEM_ONE_SHOT_FALLING)); +// break; + +// case 'L': +// CHANGING_PROGRAM(AddCoil()); +// break; + +// case 'R': +// CHANGING_PROGRAM(MakeResetOnlySelected()); +// break; + +// case 'E': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// ExportDialog(); +// } else { +// CHANGING_PROGRAM(AddReset()); +// } +// break; + +// case 'S': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// SaveProgram(); +// UpdateMainWindowTitleBar(); +// } else { +// CHANGING_PROGRAM(MakeSetOnlySelected()); +// } +// break; + +// case 'N': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// if(CheckSaveUserCancels()) break; +// if(!ProgramChangedNotSaved) { +// int r = MessageBox(MainWindow, +// _("Start new program?"), +// "LDmicro", MB_YESNO | MB_DEFBUTTON2 | +// MB_ICONQUESTION); +// if(r == IDNO) break; +// } +// NewProgram(); +// strcpy(CurrentSaveFile, ""); +// strcpy(CurrentCompileFile, ""); +// GenerateIoListDontLoseSelection(); +// RefreshScrollbars(); +// UpdateMainWindowTitleBar(); +// } else { +// CHANGING_PROGRAM(NegateSelected()); +// } +// break; + +// case 'A': +// CHANGING_PROGRAM(MakeNormalSelected()); +// break; + +// case 'T': +// CHANGING_PROGRAM(AddTimer(ELEM_RTO)); +// break; + +// case 'O': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// if(CheckSaveUserCancels()) break; +// OpenDialog(); +// } else { +// CHANGING_PROGRAM(AddTimer(ELEM_TON)); +// } +// break; + +// case 'F': +// CHANGING_PROGRAM(AddTimer(ELEM_TOF)); +// break; + +// case 'U': +// CHANGING_PROGRAM(AddCounter(ELEM_CTU)); +// break; + +// case 'I': +// CHANGING_PROGRAM(AddCounter(ELEM_CTD)); +// break; + +// case 'J': +// CHANGING_PROGRAM(AddCounter(ELEM_CTC)); +// break; + +// case 'M': +// CHANGING_PROGRAM(AddMove()); +// break; + +// case 'P': +// CHANGING_PROGRAM(AddReadAdc()); +// break; + +// case VK_OEM_PLUS: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(AddMath(ELEM_ADD)); +// } else { +// CHANGING_PROGRAM(AddCmp(ELEM_EQU)); +// } +// break; + +// case VK_OEM_MINUS: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// } else { +// CHANGING_PROGRAM(AddMath(ELEM_SUB)); +// } +// break; + +// case '8': +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(AddMath(ELEM_MUL)); +// } +// break; + +// case 'D': +// CHANGING_PROGRAM(AddMath(ELEM_DIV)); +// break; + +// case VK_OEM_PERIOD: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(AddCmp(ELEM_GRT)); +// } else { +// CHANGING_PROGRAM(AddCmp(ELEM_GEQ)); +// } +// break; + +// case VK_OEM_COMMA: +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(AddCmp(ELEM_LES)); +// } else { +// CHANGING_PROGRAM(AddCmp(ELEM_LEQ)); +// } +// break; + +// case 'V': +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(InsertRung(TRUE)); +// } +// break; + +// case '6': +// if(GetAsyncKeyState(VK_SHIFT) & 0x8000) { +// CHANGING_PROGRAM(InsertRung(FALSE)); +// } +// break; + +// case 'Z': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// UndoUndo(); +// } +// break; + +// case 'Y': +// if(GetAsyncKeyState(VK_CONTROL) & 0x8000) { +// UndoRedo(); +// } +// break; + +// default: +// break; +// } +// if(wParam != VK_SHIFT && wParam != VK_CONTROL) { +// InvalidateRect(MainWindow, NULL, FALSE); +// } +// break; +// } + +// case WM_LBUTTONDBLCLK: { +// int x = LOWORD(lParam); +// int y = HIWORD(lParam); +// if(InSimulationMode) { +// EditElementMouseDoubleclick(x, y); +// } else { +// CHANGING_PROGRAM(EditElementMouseDoubleclick(x, y)); +// } +// InvalidateRect(MainWindow, NULL, FALSE); +// break; +// } + +// case WM_LBUTTONDOWN: { +// int x = LOWORD(lParam); +// int y = HIWORD(lParam); +// if((y > (IoListTop - 9)) && (y < (IoListTop + 3))) { +// POINT pt; +// pt.x = x; pt.y = y; +// ClientToScreen(MainWindow, &pt); +// MouseY = pt.y; +// MouseHookHandle = SetWindowsHookEx(WH_MOUSE_LL, +// (HOOKPROC)MouseHook, Instance, 0); +// } +// if(!InSimulationMode) MoveCursorMouseClick(x, y); + +// SetFocus(MainWindow); +// InvalidateRect(MainWindow, NULL, FALSE); +// break; +// } +// case WM_MOUSEMOVE: { +// int x = LOWORD(lParam); +// int y = HIWORD(lParam); + +// if((y > (IoListTop - 9)) && (y < (IoListTop + 3))) { +// SetCursor(LoadCursor(NULL, IDC_SIZENS)); +// } else { +// SetCursor(LoadCursor(NULL, IDC_ARROW)); +// } - break; - } - case WM_MOUSEWHEEL: { - if((GET_WHEEL_DELTA_WPARAM(wParam)) > 0) { - VscrollProc(SB_LINEUP); - } else { - VscrollProc(SB_LINEDOWN); - } - break; - } - - case WM_SIZE: - MainWindowResized(); - break; - - case WM_NOTIFY: { - NMHDR *h = (NMHDR *)lParam; - if(h->hwndFrom == IoList) { - IoListProc(h); - } - return 0; - } - case WM_VSCROLL: - VscrollProc(wParam); - break; - - case WM_HSCROLL: - HscrollProc(wParam); - break; - - case WM_COMMAND: - ProcessMenu(LOWORD(wParam)); - InvalidateRect(MainWindow, NULL, FALSE); - break; - - case WM_CLOSE: - case WM_DESTROY: - if(CheckSaveUserCancels()) break; - - PostQuitMessage(0); - return 1; - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } - - return 1; -} +// break; +// } +// case WM_MOUSEWHEEL: { +// if((GET_WHEEL_DELTA_WPARAM(wParam)) > 0) { +// VscrollProc(SB_LINEUP); +// } else { +// VscrollProc(SB_LINEDOWN); +// } +// break; +// } + +// case WM_SIZE: +// MainWindowResized(); +// break; + +// case WM_NOTIFY: { +// NMHDR *h = (NMHDR *)lParam; +// if(h->hwndFrom == IoList) { +// IoListProc(h); +// } +// return 0; +// } +// case WM_VSCROLL: +// VscrollProc(wParam); +// break; + +// case WM_HSCROLL: +// HscrollProc(wParam); +// break; + +// case WM_COMMAND: +// ProcessMenu(LOWORD(wParam)); +// InvalidateRect(MainWindow, NULL, FALSE); +// break; + +// case WM_CLOSE: +// case WM_DESTROY: +// if(CheckSaveUserCancels()) break; + +// PostQuitMessage(0); +// return 1; +// default: +// return DefWindowProc(hwnd, msg, wParam, lParam); +// } + +// return 1; +// } //----------------------------------------------------------------------------- // Create our window class; nothing exciting. //----------------------------------------------------------------------------- -static BOOL MakeWindowClass() -{ - WNDCLASSEX wc; - memset(&wc, 0, sizeof(wc)); - wc.cbSize = sizeof(wc); - - wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | - CS_DBLCLKS; - wc.lpfnWndProc = (WNDPROC)MainWndProc; - wc.hInstance = Instance; - wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.lpszClassName = "LDmicro"; - wc.lpszMenuName = NULL; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hIcon = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), - IMAGE_ICON, 32, 32, 0); - wc.hIconSm = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), - IMAGE_ICON, 16, 16, 0); - - return RegisterClassEx(&wc); -} +// static BOOL MakeWindowClass() +// { +// WNDCLASSEX wc; +// memset(&wc, 0, sizeof(wc)); +// wc.cbSize = sizeof(wc); + +// wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | +// CS_DBLCLKS; +// wc.lpfnWndProc = (WNDPROC)MainWndProc; +// wc.hInstance = Instance; +// wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); +// wc.lpszClassName = "LDmicro"; +// wc.lpszMenuName = NULL; +// wc.hCursor = LoadCursor(NULL, IDC_ARROW); +// wc.hIcon = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), +// IMAGE_ICON, 32, 32, 0); +// wc.hIconSm = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), +// IMAGE_ICON, 16, 16, 0); + +// return RegisterClassEx(&wc); +// } //----------------------------------------------------------------------------- // Entry point into the program. //----------------------------------------------------------------------------- int main(int argc, char** argv) { - // Check if we're running in non-interactive mode; in that case we should - // load the file, compile, and exit. + /// Check if we're running in non-interactive mode; in that case we should + /// load the file, compile, and exit. + if(argc >= 2) { RunningInBatchMode = TRUE; char *err = "Bad command line arguments: run 'ldmicro /c src.ld dest.hex'"; - char *source = lpCmdLine + 2; + if (argc < 4) + { + printf("throwing error...\n"); + Error(err); + exit(-1); + } + + char *source = (char*)malloc(strlen(argv[2]) + strlen(argv[3]) + 2); + sprintf(source, "%s %s", argv[2], argv[3]); + while(isspace(*source)) { source++; } - if(*source == '\0') { Error(err); exit(-1); } + if(*source == '\0') + { + Error(err); + free(source); + exit(-1); + } + char *dest = source; while(!isspace(*dest) && *dest) { dest++; } - if(*dest == '\0') { Error(err); exit(-1); } + if(*dest == '\0') + { + Error(err); + free(source); + exit(-1); + } *dest = '\0'; dest++; while(isspace(*dest)) { dest++; } - if(*dest == '\0') { Error(err); exit(-1); } + + if(*dest == '\0') + { + Error(err); + free(source); + exit(-1); + } + if(!LoadProjectFromFile(source)) { - Error("Couldn't open '%s', running non-interactively.", source); + Error("Couldn't open '%s', running non-interactively.\n", source); + free(source); exit(-1); } strcpy(CurrentCompileFile, dest); @@ -1086,89 +1114,89 @@ int main(int argc, char** argv) exit(0); } - /// ~~~ - Instance = hInstance; - - MainHeap = HeapCreate(0, 1024*64, 0); - - // MakeWindowClass(); - // MakeDialogBoxClass(); - // MakeAdvancedDialogClass(); - // MakeAdvancedWorkspaceClass(); - // MakeComponentListClass(); - // MakeSmplDialogClass(); - // MakeNamingListClass(); - HMENU top = MakeMainWindowMenus(); - - /// Make main window - // MainWindow = CreateWindowEx(0, "LDmicro", "", - // WS_OVERLAPPED | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX | - // WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX, - // 10, 10, 800, 600, NULL, top, Instance, NULL); - ThawWindowPos(MainWindow); - IoListHeight = 100; - ThawDWORD(IoListHeight); - - InitCommonControls(); - InitForDrawing(); - - MakeMainWindowControls(); - MainWindowResized(); - NewProgram(); - strcpy(CurrentSaveFile, ""); - - // We are running interactively, or we would already have exited. We - // can therefore show the window now, and otherwise set up the GUI. - - ShowWindow(MainWindow, SW_SHOW); - SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor); + // /// ~~~ + // Instance = hInstance; /// parent window + + // MainHeap = HeapCreate(0, 1024*64, 0); + + // // MakeWindowClass(); + // // MakeDialogBoxClass(); + // // MakeAdvancedDialogClass(); + // // MakeAdvancedWorkspaceClass(); + // // MakeComponentListClass(); + // // MakeSmplDialogClass(); + // // MakeNamingListClass(); + // HMENU top = MakeMainWindowMenus(); + + // /// Make main window + // // MainWindow = CreateWindowEx(0, "LDmicro", "", + // // WS_OVERLAPPED | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX | + // // WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX, + // // 10, 10, 800, 600, NULL, top, Instance, NULL); + // ThawWindowPos(MainWindow); + // IoListHeight = 100; + // ThawDWORD(IoListHeight); + + // InitCommonControls(); + // InitForDrawing(); + + // MakeMainWindowControls(); + // MainWindowResized(); + // NewProgram(); + // strcpy(CurrentSaveFile, ""); + + // // We are running interactively, or we would already have exited. We + // // can therefore show the window now, and otherwise set up the GUI. + + // ShowWindow(MainWindow, SW_SHOW); + // SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor); - if(strlen(lpCmdLine) > 0) { - char line[MAX_PATH]; - if(*lpCmdLine == '"') { - strcpy(line, lpCmdLine+1); - } else { - strcpy(line, lpCmdLine); - } - if(strchr(line, '"')) *strchr(line, '"') = '\0'; - - char *s; - GetFullPathName(line, sizeof(CurrentSaveFile), CurrentSaveFile, &s); - if(!LoadProjectFromFile(CurrentSaveFile)) { - NewProgram(); - Error(_("Couldn't open '%s'."), CurrentSaveFile); - CurrentSaveFile[0] = '\0'; - } - UndoFlush(); - } - - GenerateIoListDontLoseSelection(); - RefreshScrollbars(); - UpdateMainWindowTitleBar(); - - MSG msg; - DWORD ret; - while(ret = GetMessage(&msg, NULL, 0, 0)) { - if(msg.hwnd == IoList && msg.message == WM_KEYDOWN) { - if(msg.wParam == VK_TAB) { - SetFocus(MainWindow); - continue; - } - } - if(msg.message == WM_KEYDOWN && msg.wParam != VK_UP && - msg.wParam != VK_DOWN && msg.wParam != VK_RETURN && msg.wParam - != VK_SHIFT) - { - if(msg.hwnd == IoList) { - msg.hwnd = MainWindow; - SetFocus(MainWindow); - } - } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - FreezeWindowPos(MainWindow); - FreezeDWORD(IoListHeight); + // if(strlen(lpCmdLine) > 0) { + // char line[MAX_PATH]; + // if(*lpCmdLine == '"') { + // strcpy(line, lpCmdLine+1); + // } else { + // strcpy(line, lpCmdLine); + // } + // if(strchr(line, '"')) *strchr(line, '"') = '\0'; + + // char *s; + // GetFullPathName(line, sizeof(CurrentSaveFile), CurrentSaveFile, &s); + // if(!LoadProjectFromFile(CurrentSaveFile)) { + // NewProgram(); + // Error(_("Couldn't open '%s'."), CurrentSaveFile); + // CurrentSaveFile[0] = '\0'; + // } + // UndoFlush(); + // } + + // GenerateIoListDontLoseSelection(); + // RefreshScrollbars(); + // UpdateMainWindowTitleBar(); + + // MSG msg; + // DWORD ret; + // while(ret = GetMessage(&msg, NULL, 0, 0)) { + // if(msg.hwnd == IoList && msg.message == WM_KEYDOWN) { + // if(msg.wParam == VK_TAB) { + // SetFocus(MainWindow); + // continue; + // } + // } + // if(msg.message == WM_KEYDOWN && msg.wParam != VK_UP && + // msg.wParam != VK_DOWN && msg.wParam != VK_RETURN && msg.wParam + // != VK_SHIFT) + // { + // if(msg.hwnd == IoList) { + // msg.hwnd = MainWindow; + // SetFocus(MainWindow); + // } + // } + // TranslateMessage(&msg); + // DispatchMessage(&msg); + // } + // FreezeWindowPos(MainWindow); + // FreezeDWORD(IoListHeight); return 0; } diff --git a/ldmicro/ldmicro.exe.manifest b/ldmicro/ldmicro.exe.manifest deleted file mode 100644 index ee71fe3..0000000 --- a/ldmicro/ldmicro.exe.manifest +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> -<assemblyIdentity - version="1.0.0.0" - processorArchitecture="X86" - name="JonathanWesthues.LadderLogic.LDMicro" - type="win32" -/> -<description>Ladder logic editor/compiler for PIC and AVR micros.</description> -<dependency> - <dependentAssembly> - <assemblyIdentity - type="win32" - name="Microsoft.Windows.Common-Controls" - version="6.0.0.0" - processorArchitecture="X86" - publicKeyToken="6595b64144ccf1df" - language="*" - /> - </dependentAssembly> -</dependency> -</assembly> diff --git a/ldmicro/ldmicro.rc b/ldmicro/ldmicro.rc deleted file mode 100644 index 952b087..0000000 --- a/ldmicro/ldmicro.rc +++ /dev/null @@ -1,19 +0,0 @@ - -// we need a manifest if we want visual styles; put in numbers since somethings a bit screwy -// with my SDK install (I don't think I've got *.rh right) - -#include "components/componentimages.h" - -1 24 "ldmicro.exe.manifest" - -4000 ICON "ldmicro.ico" -RELAY_NC PNG "img\\relay_nc.png" -RELAY_NO PNG "img\\relay_no.png" -SWITCH_CONNECTED PNG "img\\switch_connected.png" -SWITCH_DISCONNECTED PNG "img\\switch_disconnected.png" -SPDT_1 PNG "img\\spdt_1.png" -SPDT_2 PNG "img\\spdt_2.png" -DPST_1 PNG "img\\dpst_1.png" -DPST_2 PNG "img\\dpst_2.png" -DPDT_1 PNG "img\\dpdt_1.png" -DPDT_2 PNG "img\\dpdt_2.png" diff --git a/ldmicro/lib/linuxUI/linuxLD.cpp b/ldmicro/lib/linuxUI/linuxLD.cpp index 69c5f6e..e4fd018 100644 --- a/ldmicro/lib/linuxUI/linuxLD.cpp +++ b/ldmicro/lib/linuxUI/linuxLD.cpp @@ -1,2 +1,114 @@ #include "linuxUI.h" +std::vector<HEAPRECORD> HeapRecords; + +HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize) +{ + HANDLE hHeap = NULL; + HEAPRECORD hHeapRecord; + hHeapRecord.dwMaximumSize = dwMaximumSize; + hHeap = malloc(dwInitialSize); + + if (hHeap == NULL) + return NULL; + + hHeapRecord.dwSize = dwInitialSize; + hHeapRecord.hHeap = hHeap; + hHeapRecord.dwAllocatedSizeOffset = 0; + hHeapRecord.HeapID = HeapRecords.size()+1; + HeapRecords.push_back(hHeapRecord); + + return hHeap; +} + +LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes) +{ + if (hHeap == NULL) + { + printf("Alloc**********NULL HEAP***************\n"); + LPVOID p = malloc(dwBytes); + return p; + } + + auto it = std::find_if(HeapRecords.begin(), HeapRecords.end(), [&hHeap](HEAPRECORD &Record) { return Record.hHeap == hHeap; }); + + if (it == HeapRecords.end()) + return NULL; + + if ((*it).dwAllocatedSizeOffset + dwBytes > (*it).dwSize) + { + if ((*it).dwMaximumSize != 0) + if((*it).dwAllocatedSizeOffset + dwBytes > (*it).dwMaximumSize) + return NULL; + + (*it).hHeap = realloc((*it).hHeap, (*it).dwAllocatedSizeOffset + dwBytes); + hHeap = (*it).hHeap; + } + + /// HEAP_ZERO_MEMORY is set by default + DWORD flags = MAP_ANONYMOUS; + + // if ( !((dwFlags & HEAP_ZERO_MEMORY) == HEAP_ZERO_MEMORY) ) + // flags = MAP_ANONYMOUS | MAP_UNINITIALIZED; + + /* Use for setting a meamory chunck with some value + * void * memset ( void * ptr, int value, size_t num ); + */ + LPVOID p = mmap(hHeap + (*it).dwAllocatedSizeOffset, dwBytes, PROT_EXEC, flags, -1, 0); + + if (p == NULL) + return NULL; + + (*it).dwAllocatedSizeOffset += dwBytes; + HEAPCHUNCK chunck; + chunck.Chunck = p; + chunck.dwSize = dwBytes; + (*it).Element.push_back(chunck); + + return p; +} + +BOOL HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem) +{ + /// if NULL free() + if (hHeap == NULL) + { + printf("free*********NULL HEAP***************\n"); + free(lpMem); + return TRUE; + } + auto heap_it = std::find_if(HeapRecords.begin(), HeapRecords.end(), [&hHeap](HEAPRECORD &Record) { return Record.hHeap == hHeap; }); + + if (heap_it == HeapRecords.end()) + return FALSE; + + auto chunck_it = std::find_if((*heap_it).Element.begin(), (*heap_it).Element.end(), [&lpMem](HEAPCHUNCK &Chunck) { return Chunck.Chunck == lpMem; }); + + if (chunck_it == (*heap_it).Element.end()) + return FALSE; + + int result = munmap((*chunck_it).Chunck, (*chunck_it).dwSize); + + if (result == 0) + { + (*heap_it).Element.erase(chunck_it); + return TRUE; + } + else + return FALSE; + +} + +void OutputDebugString(char* str) +{ + +} + +double GetTickCount(void) +{ +// timespec now; +// clock_gettime() +// if (clock_gettime(CLOCK_MONOTONIC, &now)) +// return 0; + return 10.2;//now.tv_sec * 1000.0 + now.tv_nsec / 1000000.0; +}
\ No newline at end of file diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h index 0e4f682..e204c63 100644 --- a/ldmicro/lib/linuxUI/linuxLD.h +++ b/ldmicro/lib/linuxUI/linuxLD.h @@ -2,6 +2,10 @@ #define __LINUX_LD__ #include "linuxUI.h" +#include <ctype.h> +#include <vector> +#include <algorithm> +#include <sys/mman.h> /// common windows referances for linux @@ -10,14 +14,21 @@ /// CALLBACK or __stdcall os defined empty #define CALLBACK #define CONST const -/// typedefs + +#define HEAP_ZERO_MEMORY 0x00000008 + +/// Typedefs //typedef int64_t __int64; typedef bool BOOL; typedef unsigned char BYTE; +typedef unsigned short WORD; typedef unsigned int DWORD; +typedef unsigned int UINT; +typedef size_t SIZE_T; typedef long LONG; typedef wchar_t WCHAR; typedef char CHAR; + typedef CONST WCHAR *LPCWSTR; typedef CONST CHAR *LPCSTR; /// should be __nullterminated @@ -36,16 +47,21 @@ typedef CHAR *LPSTR; typedef LPSTR LPTSTR; #endif -/// all handles will hold a GtkWindow* type -typedef void* PVOID; +typedef void *PVOID; +typedef void *LPVOID; +typedef PVOID HFONT; +typedef PVOID HMODULE; +typedef PVOID HHOOK; +typedef PVOID HBRUSH; +typedef PVOID HFONT; typedef PVOID HANDLE; typedef HANDLE HINSTANCE; typedef HANDLE HDC; -typedef GtkWidget* HWID; -typedef GtkWidget* HMENU; -typedef GtkWindow* HWND; -typedef GtkApplication* HAPP; +typedef GtkWidget *HWID; +typedef GtkWidget *HMENU; +typedef GtkWindow *HWND; +typedef GtkApplication *HAPP; /// Check if system is x64 or x86 #if defined(__UNIX64) @@ -55,9 +71,17 @@ typedef unsigned int UINT_PTR; #endif typedef UINT_PTR WPARAM; -typedef unsigned int UINT; -/// custom classes +#if defined(__UNIX64) + typedef __int64_t LONG_PTR; +#else + typedef long LONG_PTR; +#endif + +typedef LONG_PTR LPARAM; +typedef LONG_PTR LRESULT; + +/// Custom classes class COLORREF : public GdkRGBA{ public: COLORREF() @@ -76,6 +100,58 @@ class COLORREF : public GdkRGBA{ } }; -/// functions +/// Custom structures +typedef struct HeapRecordChunckTag{ + PVOID Chunck; + SIZE_T dwSize; +} HEAPCHUNCK; + +typedef struct HeapRecordTag{ + PVOID hHeap; + DWORD HeapID; + std::vector<HEAPCHUNCK> Element; + SIZE_T dwMaximumSize; + SIZE_T dwSize; + SIZE_T dwAllocatedSizeOffset; +} HEAPRECORD; + +typedef struct tagSCROLLINFO { + UINT cbSize; + UINT fMask; + int nMin; + int nMax; + UINT nPage; + int nPos; + int nTrackPos; +} SCROLLINFO, *LPCSCROLLINFO; + +typedef struct tagNMHDR { + HWND hwndFrom; + UINT_PTR idFrom; + UINT code; +} NMHDR; + +/// Variables +extern std::vector<HEAPRECORD> HeapRecord; + +/// Functions +HANDLE HeapCreate( + DWORD flOptions, + SIZE_T dwInitialSize, + SIZE_T dwMaximumSize); + +LPVOID HeapAlloc( + HANDLE hHeap, + DWORD dwFlags, + SIZE_T dwBytes); + +BOOL HeapFree( + HANDLE hHeap, + DWORD dwFlags, + LPVOID lpMem); + +/// functions to be ported +void OutputDebugString(char*); +double GetTickCount(void); #endif
\ No newline at end of file diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 349408f..3bebf6d 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -1,8 +1,5 @@ #include "linuxUI.h" -/// Menu Variables - HWID window; - /// EnableMenuItem Variables const UINT MF_ENABLED = 0; const UINT MF_GRAYED = 1; diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h index 8efb6ef..c6bb1ac 100644 --- a/ldmicro/lib/linuxUI/linuxUI.h +++ b/ldmicro/lib/linuxUI/linuxUI.h @@ -7,6 +7,7 @@ #include <stdio.h> #include <inttypes.h> #include "linuxLD.h" +//#include "windows.h" /// version control #define LDMicro_VERSION_MAJOR 1 diff --git a/ldmicro/loadsave.cpp b/ldmicro/loadsave.cpp index 2dc4d68..a1895a5 100644 --- a/ldmicro/loadsave.cpp +++ b/ldmicro/loadsave.cpp @@ -20,7 +20,7 @@ // Load/save the circuit from/to a file in a nice ASCII format. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> @@ -62,12 +62,10 @@ static BOOL LoadLeafFromFile(char *line, void **any, int *which) } l->d.comment.str[i++] = '\0'; *which = ELEM_COMMENT; - } else if(sscanf(line, "CONTACTS %s %d", l->d.contacts.name, - &l->d.contacts.negated)==2) + } else if(sscanf(line, "CONTACTS %s %d", l->d.contacts.name, &l->d.contacts.negated)==2) { *which = ELEM_CONTACTS; - } else if(sscanf(line, "COIL %s %d %d %d", l->d.coil.name, - &l->d.coil.negated, &l->d.coil.setOnly, &l->d.coil.resetOnly)==4) + } else if(sscanf(line, "COIL %s %d %d %d", l->d.coil.name, &l->d.coil.negated, &l->d.coil.setOnly, &l->d.coil.resetOnly)==4) { *which = ELEM_COIL; } else if(memcmp(line, "PLACEHOLDER", 11)==0) { @@ -78,56 +76,45 @@ static BOOL LoadLeafFromFile(char *line, void **any, int *which) *which = ELEM_OPEN; } else if(memcmp(line, "MASTER_RELAY", 12)==0) { *which = ELEM_MASTER_RELAY; - } else if(sscanf(line, "SHIFT_REGISTER %s %d", l->d.shiftRegister.name, - &(l->d.shiftRegister.stages))==2) + } else if(sscanf(line, "SHIFT_REGISTER %s %d", l->d.shiftRegister.name, &(l->d.shiftRegister.stages))==2) { *which = ELEM_SHIFT_REGISTER; } else if(memcmp(line, "OSR", 3)==0) { *which = ELEM_ONE_SHOT_RISING; } else if(memcmp(line, "OSF", 3)==0) { *which = ELEM_ONE_SHOT_FALLING; - } else if((sscanf(line, "TON %s %d", l->d.timer.name, - &l->d.timer.delay)==2)) + } else if((sscanf(line, "TON %s %d", l->d.timer.name, &l->d.timer.delay)==2)) { *which = ELEM_TON; - } else if((sscanf(line, "TOF %s %d", l->d.timer.name, - &l->d.timer.delay)==2)) + } else if((sscanf(line, "TOF %s %d", l->d.timer.name, &l->d.timer.delay)==2)) { *which = ELEM_TOF; - } else if((sscanf(line, "RTO %s %d", l->d.timer.name, - &l->d.timer.delay)==2)) + } else if((sscanf(line, "RTO %s %d", l->d.timer.name, &l->d.timer.delay)==2)) { *which = ELEM_RTO; - } else if((sscanf(line, "CTD %s %d", l->d.counter.name, - &l->d.counter.max)==2)) + } else if((sscanf(line, "CTD %s %d", l->d.counter.name, &l->d.counter.max)==2)) { *which = ELEM_CTD; - } else if((sscanf(line, "CTU %s %d", l->d.counter.name, - &l->d.counter.max)==2)) + } else if((sscanf(line, "CTU %s %d", l->d.counter.name, &l->d.counter.max)==2)) { *which = ELEM_CTU; - } else if((sscanf(line, "CTC %s %d", l->d.counter.name, - &l->d.counter.max)==2)) + } else if((sscanf(line, "CTC %s %d", l->d.counter.name, &l->d.counter.max)==2)) { *which = ELEM_CTC; } else if(sscanf(line, "RES %s", l->d.reset.name)==1) { *which = ELEM_RES; } else if(sscanf(line, "MOVE %s %s", l->d.move.dest, l->d.move.src)==2) { *which = ELEM_MOVE; - } else if(sscanf(line, "ADD %s %s %s", l->d.math.dest, l->d.math.op1, - l->d.math.op2)==3) + } else if(sscanf(line, "ADD %s %s %s", l->d.math.dest, l->d.math.op1, l->d.math.op2)==3) { *which = ELEM_ADD; - } else if(sscanf(line, "SUB %s %s %s", l->d.math.dest, l->d.math.op1, - l->d.math.op2)==3) + } else if(sscanf(line, "SUB %s %s %s", l->d.math.dest, l->d.math.op1, l->d.math.op2)==3) { *which = ELEM_SUB; - } else if(sscanf(line, "MUL %s %s %s", l->d.math.dest, l->d.math.op1, - l->d.math.op2)==3) + } else if(sscanf(line, "MUL %s %s %s", l->d.math.dest, l->d.math.op1, l->d.math.op2)==3) { *which = ELEM_MUL; - } else if(sscanf(line, "DIV %s %s %s", l->d.math.dest, l->d.math.op1, - l->d.math.op2)==3) + } else if(sscanf(line, "DIV %s %s %s", l->d.math.dest, l->d.math.op1, l->d.math.op2)==3) { *which = ELEM_DIV; } else if(sscanf(line, "EQU %s %s", l->d.cmp.op1, l->d.cmp.op2)==2) { @@ -144,8 +131,7 @@ static BOOL LoadLeafFromFile(char *line, void **any, int *which) *which = ELEM_LES; } else if(sscanf(line, "READ_ADC %s", l->d.readAdc.name)==1) { *which = ELEM_READ_ADC; - } else if(sscanf(line, "SET_PWM %s %d", l->d.setPwm.name, - &(l->d.setPwm.targetFreq))==2) + } else if(sscanf(line, "SET_PWM %s %d", l->d.setPwm.name, &(l->d.setPwm.targetFreq))==2) { *which = ELEM_SET_PWM; } else if(sscanf(line, "UART_RECV %s", l->d.uart.name)==1) { @@ -154,8 +140,7 @@ static BOOL LoadLeafFromFile(char *line, void **any, int *which) *which = ELEM_UART_SEND; } else if(sscanf(line, "PERSIST %s", l->d.persist.var)==1) { *which = ELEM_PERSIST; - } else if(sscanf(line, "FORMATTED_STRING %s %d", l->d.fmtdStr.var, - &x)==2) + } else if(sscanf(line, "FORMATTED_STRING %s %d", l->d.fmtdStr.var, &x)==2) { if(strcmp(l->d.fmtdStr.var, "(none)")==0) { strcpy(l->d.fmtdStr.var, ""); @@ -228,6 +213,7 @@ static BOOL LoadLeafFromFile(char *line, void **any, int *which) return FALSE; } *any = l; + return TRUE; } @@ -283,16 +269,23 @@ static ElemSubcktSeries *LoadSeriesFromFile(FILE *f) int which; ElemSubcktSeries *ret = AllocSubcktSeries(); + int cnt = 0; for(;;) { + if(!fgets(line, sizeof(line), f)) return NULL; + char *s = line; + + while(isspace(*s)) s++; if(strcmp(s, "PARALLEL\n")==0) { + which = ELEM_PARALLEL_SUBCKT; any = LoadParallelFromFile(f); + if(!any) return NULL; } else if(LoadLeafFromFile(s, &any, &which)) { @@ -303,9 +296,11 @@ static ElemSubcktSeries *LoadSeriesFromFile(FILE *f) } else { return NULL; } + ret->contents[cnt].which = which; ret->contents[cnt].d.any = any; cnt++; + if(cnt >= MAX_ELEMENTS_IN_SUBCKT) return NULL; } } @@ -364,10 +359,14 @@ BOOL LoadProjectFromFile(char *filename) int rung; for(rung = 0;;) { if(!fgets(line, sizeof(line), f)) break; + if(strcmp(line, "RUNG\n")!=0) goto failed; Prog.rungs[rung] = LoadSeriesFromFile(f); - if(!Prog.rungs[rung]) goto failed; + + if(!Prog.rungs[rung]) + goto failed; + rung++; } Prog.numRungs = rung; diff --git a/ldmicro/lutdialog.cpp b/ldmicro/lutdialog.cpp index 91898b3..fde3156 100644 --- a/ldmicro/lutdialog.cpp +++ b/ldmicro/lutdialog.cpp @@ -23,29 +23,29 @@ // in between the points. // Jonathan Westhues, Dec 2005 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> -#include <commctrl.h> +//#include <commctrl.h> #include "ldmicro.h" -static HWND LutDialog; +// static HWND LutDialog; -static HWND AsStringCheckbox; -static HWND CountTextbox; -static HWND DestTextbox; -static HWND IndexTextbox; -static HWND Labels[3]; +// static HWND AsStringCheckbox; +// static HWND CountTextbox; +// static HWND DestTextbox; +// static HWND IndexTextbox; +// static HWND Labels[3]; -static HWND StringTextbox; +// static HWND StringTextbox; static BOOL WasAsString; static int WasCount; -static HWND ValuesTextbox[MAX_LOOK_UP_TABLE_LEN]; +//static HWND ValuesTextbox[MAX_LOOK_UP_TABLE_LEN]; static LONG_PTR PrevValuesProc[MAX_LOOK_UP_TABLE_LEN]; -static HWND ValuesLabel[MAX_LOOK_UP_TABLE_LEN]; +//static HWND ValuesLabel[MAX_LOOK_UP_TABLE_LEN]; static SWORD ValuesCache[MAX_LOOK_UP_TABLE_LEN]; @@ -56,65 +56,65 @@ static LONG_PTR PrevCountProc; //----------------------------------------------------------------------------- // Don't allow any characters other than 0-9 and minus in the values. //----------------------------------------------------------------------------- -static LRESULT CALLBACK MyNumberProc(HWND hwnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - if(msg == WM_CHAR) { - if(!(isdigit(wParam) || wParam == '\b' || wParam == '-')) { - return 0; - } - } +// static LRESULT CALLBACK MyNumberProc(HWND hwnd, UINT msg, WPARAM wParam, +// LPARAM lParam) +// { +// if(msg == WM_CHAR) { +// if(!(isdigit(wParam) || wParam == '\b' || wParam == '-')) { +// return 0; +// } +// } - WNDPROC w; - int i; - for(i = 0; i < MAX_LOOK_UP_TABLE_LEN; i++) { - if(hwnd == ValuesTextbox[i]) { - w = (WNDPROC)PrevValuesProc[i]; - break; - } - } - if(i == MAX_LOOK_UP_TABLE_LEN) oops(); - - return CallWindowProc(w, hwnd, msg, wParam, lParam); -} +// WNDPROC w; +// int i; +// for(i = 0; i < MAX_LOOK_UP_TABLE_LEN; i++) { +// if(hwnd == ValuesTextbox[i]) { +// w = (WNDPROC)PrevValuesProc[i]; +// break; +// } +// } +// if(i == MAX_LOOK_UP_TABLE_LEN) oops(); + +// return CallWindowProc(w, hwnd, msg, wParam, lParam); +// } //----------------------------------------------------------------------------- // Don't allow any characters other than 0-9 in the count. //----------------------------------------------------------------------------- -static LRESULT CALLBACK MyDigitsProc(HWND hwnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - if(msg == WM_CHAR) { - if(!(isdigit(wParam) || wParam == '\b')) { - return 0; - } - } - - return CallWindowProc((WNDPROC)PrevCountProc, hwnd, msg, wParam, lParam); -} +// static LRESULT CALLBACK MyDigitsProc(HWND hwnd, UINT msg, WPARAM wParam, +// LPARAM lParam) +// { +// if(msg == WM_CHAR) { +// if(!(isdigit(wParam) || wParam == '\b')) { +// return 0; +// } +// } + +// return CallWindowProc((WNDPROC)PrevCountProc, hwnd, msg, wParam, lParam); +// } //----------------------------------------------------------------------------- // Don't allow any characters other than A-Za-z0-9_ in the name. //----------------------------------------------------------------------------- -static LRESULT CALLBACK MyNameProc(HWND hwnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - if(msg == WM_CHAR) { - if(!(isalpha(wParam) || isdigit(wParam) || wParam == '_' || - wParam == '\b')) - { - return 0; - } - } - - WNDPROC w; - if(hwnd == DestTextbox) { - w = (WNDPROC)PrevDestProc; - } else if(hwnd == IndexTextbox) { - w = (WNDPROC)PrevIndexProc; - } - return CallWindowProc(w, hwnd, msg, wParam, lParam); -} +// static LRESULT CALLBACK MyNameProc(HWND hwnd, UINT msg, WPARAM wParam, +// LPARAM lParam) +// { +// if(msg == WM_CHAR) { +// if(!(isalpha(wParam) || isdigit(wParam) || wParam == '_' || +// wParam == '\b')) +// { +// return 0; +// } +// } + +// WNDPROC w; +// if(hwnd == DestTextbox) { +// w = (WNDPROC)PrevDestProc; +// } else if(hwnd == IndexTextbox) { +// w = (WNDPROC)PrevIndexProc; +// } +// return CallWindowProc(w, hwnd, msg, wParam, lParam); +// } //----------------------------------------------------------------------------- // Make the controls that are guaranteed not to move around as the count/ @@ -122,92 +122,92 @@ static LRESULT CALLBACK MyNameProc(HWND hwnd, UINT msg, WPARAM wParam, // because in that case we should not provide a checkbox to change whether // the table is edited as a string or table. //----------------------------------------------------------------------------- -static void MakeFixedControls(BOOL forPwl) -{ - Labels[0] = CreateWindowEx(0, WC_STATIC, _("Destination:"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, - 0, 10, 78, 21, LutDialog, NULL, Instance, NULL); - NiceFont(Labels[0]); - - DestTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 85, 10, 120, 21, LutDialog, NULL, Instance, NULL); - FixedFont(DestTextbox); - - Labels[1] = CreateWindowEx(0, WC_STATIC, _("Index:"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, - 10, 40, 68, 21, LutDialog, NULL, Instance, NULL); - NiceFont(Labels[1]); - - IndexTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 85, 40, 120, 21, LutDialog, NULL, Instance, NULL); - FixedFont(IndexTextbox); - - Labels[2] = CreateWindowEx(0,WC_STATIC, forPwl ? _("Points:") : _("Count:"), - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, - 0, 70, 78, 21, LutDialog, NULL, Instance, NULL); - NiceFont(Labels[2]); - - CountTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 85, 70, 120, 21, LutDialog, NULL, Instance, NULL); - NiceFont(CountTextbox); - - if(!forPwl) { - AsStringCheckbox = CreateWindowEx(0, WC_BUTTON, - _("Edit table of ASCII values like a string"), WS_CHILD | - WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_AUTOCHECKBOX, - 10, 100, 300, 21, LutDialog, NULL, Instance, NULL); - NiceFont(AsStringCheckbox); - } - - OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, - 231, 10, 70, 23, LutDialog, NULL, Instance, NULL); - NiceFont(OkButton); - - CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), - WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, - 231, 40, 70, 23, LutDialog, NULL, Instance, NULL); - NiceFont(CancelButton); - - PrevDestProc = SetWindowLongPtr(DestTextbox, GWLP_WNDPROC, - (LONG_PTR)MyNameProc); - PrevIndexProc = SetWindowLongPtr(IndexTextbox, GWLP_WNDPROC, - (LONG_PTR)MyNameProc); - PrevCountProc = SetWindowLongPtr(CountTextbox, GWLP_WNDPROC, - (LONG_PTR)MyDigitsProc); -} +// static void MakeFixedControls(BOOL forPwl) +// { +// Labels[0] = CreateWindowEx(0, WC_STATIC, _("Destination:"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, +// 0, 10, 78, 21, LutDialog, NULL, Instance, NULL); +// NiceFont(Labels[0]); + +// DestTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 85, 10, 120, 21, LutDialog, NULL, Instance, NULL); +// FixedFont(DestTextbox); + +// Labels[1] = CreateWindowEx(0, WC_STATIC, _("Index:"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, +// 10, 40, 68, 21, LutDialog, NULL, Instance, NULL); +// NiceFont(Labels[1]); + +// IndexTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 85, 40, 120, 21, LutDialog, NULL, Instance, NULL); +// FixedFont(IndexTextbox); + +// Labels[2] = CreateWindowEx(0,WC_STATIC, forPwl ? _("Points:") : _("Count:"), +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT, +// 0, 70, 78, 21, LutDialog, NULL, Instance, NULL); +// NiceFont(Labels[2]); + +// CountTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 85, 70, 120, 21, LutDialog, NULL, Instance, NULL); +// NiceFont(CountTextbox); + +// if(!forPwl) { +// AsStringCheckbox = CreateWindowEx(0, WC_BUTTON, +// _("Edit table of ASCII values like a string"), WS_CHILD | +// WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_AUTOCHECKBOX, +// 10, 100, 300, 21, LutDialog, NULL, Instance, NULL); +// NiceFont(AsStringCheckbox); +// } + +// OkButton = CreateWindowEx(0, WC_BUTTON, _("OK"), +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE | BS_DEFPUSHBUTTON, +// 231, 10, 70, 23, LutDialog, NULL, Instance, NULL); +// NiceFont(OkButton); + +// CancelButton = CreateWindowEx(0, WC_BUTTON, _("Cancel"), +// WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE, +// 231, 40, 70, 23, LutDialog, NULL, Instance, NULL); +// NiceFont(CancelButton); + +// PrevDestProc = SetWindowLongPtr(DestTextbox, GWLP_WNDPROC, +// (LONG_PTR)MyNameProc); +// PrevIndexProc = SetWindowLongPtr(IndexTextbox, GWLP_WNDPROC, +// (LONG_PTR)MyNameProc); +// PrevCountProc = SetWindowLongPtr(CountTextbox, GWLP_WNDPROC, +// (LONG_PTR)MyDigitsProc); +// } //----------------------------------------------------------------------------- // Destroy all of the controls so that we can start anew. This is necessary // because if the size of the LUT changes, or if the user switches from // table entry to string entry, we must completely reconfigure the dialog. //----------------------------------------------------------------------------- -static void DestroyLutControls(void) -{ - if(WasAsString) { - // Nothing to do; we constantly update the cache from the user- - // specified string, because we might as well do that when we - // calculate the length. - } else { - int i; - for(i = 0; i < WasCount; i++) { - char buf[20]; - SendMessage(ValuesTextbox[i], WM_GETTEXT, (WPARAM)16, (LPARAM)buf); - ValuesCache[i] = atoi(buf); - } - } - - DestroyWindow(StringTextbox); - - int i; - for(i = 0; i < MAX_LOOK_UP_TABLE_LEN; i++) { - DestroyWindow(ValuesTextbox[i]); - DestroyWindow(ValuesLabel[i]); - } -} +// static void DestroyLutControls(void) +// { +// if(WasAsString) { +// // Nothing to do; we constantly update the cache from the user- +// // specified string, because we might as well do that when we +// // calculate the length. +// } else { +// int i; +// for(i = 0; i < WasCount; i++) { +// char buf[20]; +// SendMessage(ValuesTextbox[i], WM_GETTEXT, (WPARAM)16, (LPARAM)buf); +// ValuesCache[i] = atoi(buf); +// } +// } + +// DestroyWindow(StringTextbox); + +// int i; +// for(i = 0; i < MAX_LOOK_UP_TABLE_LEN; i++) { +// DestroyWindow(ValuesTextbox[i]); +// DestroyWindow(ValuesLabel[i]); +// } +// } //----------------------------------------------------------------------------- // Make the controls that hold the LUT. The exact configuration of the dialog @@ -215,96 +215,96 @@ static void DestroyLutControls(void) // and for table-type entry, on (b) the number of entries, and on (c) // whether we are editing a PWL table (list of points) or a straight LUT. //----------------------------------------------------------------------------- -static void MakeLutControls(BOOL asString, int count, BOOL forPwl) -{ - // Remember these, so that we know from where to cache stuff if we have - // to destroy these textboxes and make something new later. - WasAsString = asString; - WasCount = count; - - if(forPwl && asString) oops(); - - if(asString) { - char str[3*MAX_LOOK_UP_TABLE_LEN+1]; - int i, j; - j = 0; - for(i = 0; i < count; i++) { - int c = ValuesCache[i]; - if(c >= 32 && c <= 127 && c != '\\') { - str[j++] = c; - } else if(c == '\\') { - str[j++] = '\\'; - str[j++] = '\\'; - } else if(c == '\r') { - str[j++] = '\\'; - str[j++] = 'r'; - } else if(c == '\b') { - str[j++] = '\\'; - str[j++] = 'b'; - } else if(c == '\f') { - str[j++] = '\\'; - str[j++] = 'f'; - } else if(c == '\n') { - str[j++] = '\\'; - str[j++] = 'n'; - } else { - str[j++] = 'X'; - } - } - str[j++] = '\0'; - StringTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, str, - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | - WS_VISIBLE, - 10, 130, 294, 21, LutDialog, NULL, Instance, NULL); - FixedFont(StringTextbox); - SendMessage(CountTextbox, EM_SETREADONLY, (WPARAM)TRUE, 0); - MoveWindow(LutDialog, 100, 30, 320, 185, TRUE); - } else { - int i; - int base; - if(forPwl) { - base = 100; - } else { - base = 140; - } - for(i = 0; i < count; i++) { - int x, y; - - if(i < 16) { - x = 10; - y = base+30*i; - } else { - x = 160; - y = base+30*(i-16); - } - - char buf[20]; - sprintf(buf, "%d", ValuesCache[i]); - ValuesTextbox[i] = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, buf, - WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | - WS_VISIBLE, - x+30, y, 80, 21, LutDialog, NULL, Instance, NULL); - NiceFont(ValuesTextbox[i]); - - if(forPwl) { - sprintf(buf, "%c%d:", (i & 1) ? 'y' : 'x', i/2); - } else { - sprintf(buf, "%2d:", i); - } - ValuesLabel[i] = CreateWindowEx(0, WC_STATIC, buf, - WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, - x, y+3, 100, 21, LutDialog, NULL, Instance, NULL); - FixedFont(ValuesLabel[i]); - - PrevValuesProc[i] = SetWindowLongPtr(ValuesTextbox[i], - GWLP_WNDPROC, (LONG_PTR)MyNumberProc); - } - if(count > 16) count = 16; - SendMessage(CountTextbox, EM_SETREADONLY, (WPARAM)FALSE, 0); - - MoveWindow(LutDialog, 100, 30, 320, base + 30 + count*30, TRUE); - } -} +// static void MakeLutControls(BOOL asString, int count, BOOL forPwl) +// { +// // Remember these, so that we know from where to cache stuff if we have +// // to destroy these textboxes and make something new later. +// WasAsString = asString; +// WasCount = count; + +// if(forPwl && asString) oops(); + +// if(asString) { +// char str[3*MAX_LOOK_UP_TABLE_LEN+1]; +// int i, j; +// j = 0; +// for(i = 0; i < count; i++) { +// int c = ValuesCache[i]; +// if(c >= 32 && c <= 127 && c != '\\') { +// str[j++] = c; +// } else if(c == '\\') { +// str[j++] = '\\'; +// str[j++] = '\\'; +// } else if(c == '\r') { +// str[j++] = '\\'; +// str[j++] = 'r'; +// } else if(c == '\b') { +// str[j++] = '\\'; +// str[j++] = 'b'; +// } else if(c == '\f') { +// str[j++] = '\\'; +// str[j++] = 'f'; +// } else if(c == '\n') { +// str[j++] = '\\'; +// str[j++] = 'n'; +// } else { +// str[j++] = 'X'; +// } +// } +// str[j++] = '\0'; +// StringTextbox = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, str, +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | +// WS_VISIBLE, +// 10, 130, 294, 21, LutDialog, NULL, Instance, NULL); +// FixedFont(StringTextbox); +// SendMessage(CountTextbox, EM_SETREADONLY, (WPARAM)TRUE, 0); +// MoveWindow(LutDialog, 100, 30, 320, 185, TRUE); +// } else { +// int i; +// int base; +// if(forPwl) { +// base = 100; +// } else { +// base = 140; +// } +// for(i = 0; i < count; i++) { +// int x, y; + +// if(i < 16) { +// x = 10; +// y = base+30*i; +// } else { +// x = 160; +// y = base+30*(i-16); +// } + +// char buf[20]; +// sprintf(buf, "%d", ValuesCache[i]); +// ValuesTextbox[i] = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, buf, +// WS_CHILD | ES_AUTOHSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | +// WS_VISIBLE, +// x+30, y, 80, 21, LutDialog, NULL, Instance, NULL); +// NiceFont(ValuesTextbox[i]); + +// if(forPwl) { +// sprintf(buf, "%c%d:", (i & 1) ? 'y' : 'x', i/2); +// } else { +// sprintf(buf, "%2d:", i); +// } +// ValuesLabel[i] = CreateWindowEx(0, WC_STATIC, buf, +// WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, +// x, y+3, 100, 21, LutDialog, NULL, Instance, NULL); +// FixedFont(ValuesLabel[i]); + +// PrevValuesProc[i] = SetWindowLongPtr(ValuesTextbox[i], +// GWLP_WNDPROC, (LONG_PTR)MyNumberProc); +// } +// if(count > 16) count = 16; +// SendMessage(CountTextbox, EM_SETREADONLY, (WPARAM)FALSE, 0); + +// MoveWindow(LutDialog, 100, 30, 320, base + 30 + count*30, TRUE); +// } +// } //----------------------------------------------------------------------------- // Decode a string into a look-up table; store the values in ValuesCache[], @@ -312,36 +312,36 @@ static void MakeLutControls(BOOL asString, int count, BOOL forPwl) // reflect the new length. Returns FALSE if the new string is too long, else // TRUE. //----------------------------------------------------------------------------- -BOOL StringToValuesCache(char *str, int *c) -{ - int count = 0; - while(*str) { - if(*str == '\\') { - str++; - switch(*str) { - case 'r': ValuesCache[count++] = '\r'; break; - case 'n': ValuesCache[count++] = '\n'; break; - case 'f': ValuesCache[count++] = '\f'; break; - case 'b': ValuesCache[count++] = '\b'; break; - default: ValuesCache[count++] = *str; break; - } - } else { - ValuesCache[count++] = *str; - } - if(*str) { - str++; - } - if(count >= 32) { - return FALSE; - } - } - - char buf[10]; - sprintf(buf, "%d", count); - SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)(buf)); - *c = count; - return TRUE; -} +// BOOL StringToValuesCache(char *str, int *c) +// { +// int count = 0; +// while(*str) { +// if(*str == '\\') { +// str++; +// switch(*str) { +// case 'r': ValuesCache[count++] = '\r'; break; +// case 'n': ValuesCache[count++] = '\n'; break; +// case 'f': ValuesCache[count++] = '\f'; break; +// case 'b': ValuesCache[count++] = '\b'; break; +// default: ValuesCache[count++] = *str; break; +// } +// } else { +// ValuesCache[count++] = *str; +// } +// if(*str) { +// str++; +// } +// if(count >= 32) { +// return FALSE; +// } +// } + +// char buf[10]; +// sprintf(buf, "%d", count); +// SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)(buf)); +// *c = count; +// return TRUE; +// } //----------------------------------------------------------------------------- // Show the look-up table dialog. This one is nasty, mostly because there are @@ -349,217 +349,217 @@ BOOL StringToValuesCache(char *str, int *c) // I should convert between those two representations on the fly, as the user // edit things, so I do. //----------------------------------------------------------------------------- -void ShowLookUpTableDialog(ElemLeaf *l) -{ - ElemLookUpTable *t = &(l->d.lookUpTable); - - // First copy over all the stuff from the leaf structure; in particular, - // we need our own local copy of the table entries, because it would be - // bad to update those in the leaf before the user clicks okay (as he - // might cancel). - int count = t->count; - BOOL asString = t->editAsString; - memset(ValuesCache, 0, sizeof(ValuesCache)); - int i; - for(i = 0; i < count; i++) { - ValuesCache[i] = t->vals[i]; - } - - // Now create the dialog's fixed controls, plus the changing (depending - // on show style/entry count) controls for the initial configuration. - LutDialog = CreateWindowClient(0, "LDmicroDialog", - _("Look-Up Table"), WS_OVERLAPPED | WS_SYSMENU, - 100, 100, 320, 375, NULL, NULL, Instance, NULL); - MakeFixedControls(FALSE); - MakeLutControls(asString, count, FALSE); +// void ShowLookUpTableDialog(ElemLeaf *l) +// { +// ElemLookUpTable *t = &(l->d.lookUpTable); + +// // First copy over all the stuff from the leaf structure; in particular, +// // we need our own local copy of the table entries, because it would be +// // bad to update those in the leaf before the user clicks okay (as he +// // might cancel). +// int count = t->count; +// BOOL asString = t->editAsString; +// memset(ValuesCache, 0, sizeof(ValuesCache)); +// int i; +// for(i = 0; i < count; i++) { +// ValuesCache[i] = t->vals[i]; +// } + +// // Now create the dialog's fixed controls, plus the changing (depending +// // on show style/entry count) controls for the initial configuration. +// LutDialog = CreateWindowClient(0, "LDmicroDialog", +// _("Look-Up Table"), WS_OVERLAPPED | WS_SYSMENU, +// 100, 100, 320, 375, NULL, NULL, Instance, NULL); +// MakeFixedControls(FALSE); +// MakeLutControls(asString, count, FALSE); - // Set up the controls to reflect the initial configuration. - SendMessage(DestTextbox, WM_SETTEXT, 0, (LPARAM)(t->dest)); - SendMessage(IndexTextbox, WM_SETTEXT, 0, (LPARAM)(t->index)); - char buf[30]; - sprintf(buf, "%d", t->count); - SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)buf); - if(asString) { - SendMessage(AsStringCheckbox, BM_SETCHECK, BST_CHECKED, 0); - } - - // And show the window - EnableWindow(MainWindow, FALSE); - ShowWindow(LutDialog, TRUE); - SetFocus(DestTextbox); - SendMessage(DestTextbox, EM_SETSEL, 0, -1); - - char PrevTableAsString[1024] = ""; - - MSG msg; - DWORD ret; - DialogDone = FALSE; - DialogCancel = FALSE; - while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { - if(msg.message == WM_KEYDOWN) { - if(msg.wParam == VK_RETURN) { - DialogDone = TRUE; - break; - } else if(msg.wParam == VK_ESCAPE) { - DialogDone = TRUE; - DialogCancel = TRUE; - break; - } - } - - if(!IsDialogMessage(LutDialog, &msg)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - // Are we in table mode? In that case watch the (user-editable) count - // field, and use that to determine how many textboxes to show. - char buf[20]; - SendMessage(CountTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)buf); - if(atoi(buf) != count && !asString) { - count = atoi(buf); - if(count < 0 || count > 32) { - count = 0; - SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)""); - } - DestroyLutControls(); - MakeLutControls(asString, count, FALSE); - } - - // Are we in string mode? In that case watch the string textbox, - // and use that to update the (read-only) count field. - if(asString) { - char scratch[1024]; - SendMessage(StringTextbox, WM_GETTEXT, (WPARAM)sizeof(scratch), - (LPARAM)scratch); - if(strcmp(scratch, PrevTableAsString)!=0) { - if(StringToValuesCache(scratch, &count)) { - strcpy(PrevTableAsString, scratch); - } else { - // Too long; put back the old one - SendMessage(StringTextbox, WM_SETTEXT, 0, - (LPARAM)PrevTableAsString); - } - } - } - - // Did we just change modes? - BOOL x = SendMessage(AsStringCheckbox, BM_GETCHECK, 0, 0)==BST_CHECKED; - if((x && !asString) || (!x && asString)) { - asString = x; - DestroyLutControls(); - MakeLutControls(asString, count, FALSE); - } - - } - - if(!DialogCancel) { - SendMessage(DestTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->dest)); - SendMessage(IndexTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->index)); - DestroyLutControls(); - // The call to DestroyLutControls updated ValuesCache, so just read - // them out of there (whichever mode we were in before). - int i; - for(i = 0; i < count; i++) { - t->vals[i] = ValuesCache[i]; - } - t->count = count; - t->editAsString = asString; - } - - EnableWindow(MainWindow, TRUE); - DestroyWindow(LutDialog); -} +// // Set up the controls to reflect the initial configuration. +// SendMessage(DestTextbox, WM_SETTEXT, 0, (LPARAM)(t->dest)); +// SendMessage(IndexTextbox, WM_SETTEXT, 0, (LPARAM)(t->index)); +// char buf[30]; +// sprintf(buf, "%d", t->count); +// SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)buf); +// if(asString) { +// SendMessage(AsStringCheckbox, BM_SETCHECK, BST_CHECKED, 0); +// } + +// // And show the window +// EnableWindow(MainWindow, FALSE); +// ShowWindow(LutDialog, TRUE); +// SetFocus(DestTextbox); +// SendMessage(DestTextbox, EM_SETSEL, 0, -1); + +// char PrevTableAsString[1024] = ""; + +// MSG msg; +// DWORD ret; +// DialogDone = FALSE; +// DialogCancel = FALSE; +// while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { +// if(msg.message == WM_KEYDOWN) { +// if(msg.wParam == VK_RETURN) { +// DialogDone = TRUE; +// break; +// } else if(msg.wParam == VK_ESCAPE) { +// DialogDone = TRUE; +// DialogCancel = TRUE; +// break; +// } +// } + +// if(!IsDialogMessage(LutDialog, &msg)) { +// TranslateMessage(&msg); +// DispatchMessage(&msg); +// } + +// // Are we in table mode? In that case watch the (user-editable) count +// // field, and use that to determine how many textboxes to show. +// char buf[20]; +// SendMessage(CountTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)buf); +// if(atoi(buf) != count && !asString) { +// count = atoi(buf); +// if(count < 0 || count > 32) { +// count = 0; +// SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)""); +// } +// DestroyLutControls(); +// MakeLutControls(asString, count, FALSE); +// } + +// // Are we in string mode? In that case watch the string textbox, +// // and use that to update the (read-only) count field. +// if(asString) { +// char scratch[1024]; +// SendMessage(StringTextbox, WM_GETTEXT, (WPARAM)sizeof(scratch), +// (LPARAM)scratch); +// if(strcmp(scratch, PrevTableAsString)!=0) { +// if(StringToValuesCache(scratch, &count)) { +// strcpy(PrevTableAsString, scratch); +// } else { +// // Too long; put back the old one +// SendMessage(StringTextbox, WM_SETTEXT, 0, +// (LPARAM)PrevTableAsString); +// } +// } +// } + +// // Did we just change modes? +// BOOL x = SendMessage(AsStringCheckbox, BM_GETCHECK, 0, 0)==BST_CHECKED; +// if((x && !asString) || (!x && asString)) { +// asString = x; +// DestroyLutControls(); +// MakeLutControls(asString, count, FALSE); +// } + +// } + +// if(!DialogCancel) { +// SendMessage(DestTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->dest)); +// SendMessage(IndexTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->index)); +// DestroyLutControls(); +// // The call to DestroyLutControls updated ValuesCache, so just read +// // them out of there (whichever mode we were in before). +// int i; +// for(i = 0; i < count; i++) { +// t->vals[i] = ValuesCache[i]; +// } +// t->count = count; +// t->editAsString = asString; +// } + +// EnableWindow(MainWindow, TRUE); +// DestroyWindow(LutDialog); +// } //----------------------------------------------------------------------------- // Show the piecewise linear table dialog. This one can only be edited in // only a single format, which makes things easier than before. //----------------------------------------------------------------------------- -void ShowPiecewiseLinearDialog(ElemLeaf *l) -{ - ElemPiecewiseLinear *t = &(l->d.piecewiseLinear); - - // First copy over all the stuff from the leaf structure; in particular, - // we need our own local copy of the table entries, because it would be - // bad to update those in the leaf before the user clicks okay (as he - // might cancel). - int count = t->count; - memset(ValuesCache, 0, sizeof(ValuesCache)); - int i; - for(i = 0; i < count*2; i++) { - ValuesCache[i] = t->vals[i]; - } - - // Now create the dialog's fixed controls, plus the changing (depending - // on show style/entry count) controls for the initial configuration. - LutDialog = CreateWindowClient(0, "LDmicroDialog", - _("Piecewise Linear Table"), WS_OVERLAPPED | WS_SYSMENU, - 100, 100, 320, 375, NULL, NULL, Instance, NULL); - MakeFixedControls(TRUE); - MakeLutControls(FALSE, count*2, TRUE); +// void ShowPiecewiseLinearDialog(ElemLeaf *l) +// { +// ElemPiecewiseLinear *t = &(l->d.piecewiseLinear); + +// // First copy over all the stuff from the leaf structure; in particular, +// // we need our own local copy of the table entries, because it would be +// // bad to update those in the leaf before the user clicks okay (as he +// // might cancel). +// int count = t->count; +// memset(ValuesCache, 0, sizeof(ValuesCache)); +// int i; +// for(i = 0; i < count*2; i++) { +// ValuesCache[i] = t->vals[i]; +// } + +// // Now create the dialog's fixed controls, plus the changing (depending +// // on show style/entry count) controls for the initial configuration. +// LutDialog = CreateWindowClient(0, "LDmicroDialog", +// _("Piecewise Linear Table"), WS_OVERLAPPED | WS_SYSMENU, +// 100, 100, 320, 375, NULL, NULL, Instance, NULL); +// MakeFixedControls(TRUE); +// MakeLutControls(FALSE, count*2, TRUE); - // Set up the controls to reflect the initial configuration. - SendMessage(DestTextbox, WM_SETTEXT, 0, (LPARAM)(t->dest)); - SendMessage(IndexTextbox, WM_SETTEXT, 0, (LPARAM)(t->index)); - char buf[30]; - sprintf(buf, "%d", t->count); - SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)buf); - - // And show the window - EnableWindow(MainWindow, FALSE); - ShowWindow(LutDialog, TRUE); - SetFocus(DestTextbox); - SendMessage(DestTextbox, EM_SETSEL, 0, -1); - - MSG msg; - DWORD ret; - DialogDone = FALSE; - DialogCancel = FALSE; - while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { - if(msg.message == WM_KEYDOWN) { - if(msg.wParam == VK_RETURN) { - DialogDone = TRUE; - break; - } else if(msg.wParam == VK_ESCAPE) { - DialogDone = TRUE; - DialogCancel = TRUE; - break; - } - } - - if(!IsDialogMessage(LutDialog, &msg)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - // Watch the (user-editable) count field, and use that to - // determine how many textboxes to show. - char buf[20]; - SendMessage(CountTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)buf); - if(atoi(buf) != count) { - count = atoi(buf); - if(count < 0 || count > 10) { - count = 0; - SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)""); - } - DestroyLutControls(); - MakeLutControls(FALSE, count*2, TRUE); - } - } - - if(!DialogCancel) { - SendMessage(DestTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->dest)); - SendMessage(IndexTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->index)); - DestroyLutControls(); - // The call to DestroyLutControls updated ValuesCache, so just read - // them out of there. - int i; - for(i = 0; i < count*2; i++) { - t->vals[i] = ValuesCache[i]; - } - t->count = count; - } - - EnableWindow(MainWindow, TRUE); - DestroyWindow(LutDialog); -} +// // Set up the controls to reflect the initial configuration. +// SendMessage(DestTextbox, WM_SETTEXT, 0, (LPARAM)(t->dest)); +// SendMessage(IndexTextbox, WM_SETTEXT, 0, (LPARAM)(t->index)); +// char buf[30]; +// sprintf(buf, "%d", t->count); +// SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)buf); + +// // And show the window +// EnableWindow(MainWindow, FALSE); +// ShowWindow(LutDialog, TRUE); +// SetFocus(DestTextbox); +// SendMessage(DestTextbox, EM_SETSEL, 0, -1); + +// MSG msg; +// DWORD ret; +// DialogDone = FALSE; +// DialogCancel = FALSE; +// while((ret = GetMessage(&msg, NULL, 0, 0)) && !DialogDone) { +// if(msg.message == WM_KEYDOWN) { +// if(msg.wParam == VK_RETURN) { +// DialogDone = TRUE; +// break; +// } else if(msg.wParam == VK_ESCAPE) { +// DialogDone = TRUE; +// DialogCancel = TRUE; +// break; +// } +// } + +// if(!IsDialogMessage(LutDialog, &msg)) { +// TranslateMessage(&msg); +// DispatchMessage(&msg); +// } + +// // Watch the (user-editable) count field, and use that to +// // determine how many textboxes to show. +// char buf[20]; +// SendMessage(CountTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)buf); +// if(atoi(buf) != count) { +// count = atoi(buf); +// if(count < 0 || count > 10) { +// count = 0; +// SendMessage(CountTextbox, WM_SETTEXT, 0, (LPARAM)""); +// } +// DestroyLutControls(); +// MakeLutControls(FALSE, count*2, TRUE); +// } +// } + +// if(!DialogCancel) { +// SendMessage(DestTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->dest)); +// SendMessage(IndexTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(t->index)); +// DestroyLutControls(); +// // The call to DestroyLutControls updated ValuesCache, so just read +// // them out of there. +// int i; +// for(i = 0; i < count*2; i++) { +// t->vals[i] = ValuesCache[i]; +// } +// t->count = count; +// } + +// EnableWindow(MainWindow, TRUE); +// DestroyWindow(LutDialog); +// } diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp index 38c9b9f..5e328cf 100644 --- a/ldmicro/maincontrols.cpp +++ b/ldmicro/maincontrols.cpp @@ -22,9 +22,9 @@ // scrolling, I/O list, menus. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> -#include <commctrl.h> -#include <commdlg.h> +#include "linuxUI.h" +//#include <commctrl.h> +//#include <commdlg.h> #include <stdio.h> #include <stdlib.h> #include "ldmicro.h" @@ -103,26 +103,26 @@ HMENU MNU_ABOUT; HMENU MNU_ADV_SIMULATION; // scrollbars for the ladder logic area -static HWND HorizScrollBar; -static HWND VertScrollBar; +// static HWND HorizScrollBar; +// static HWND VertScrollBar; int ScrollWidth; int ScrollHeight; BOOL NeedHoriz; // status bar at the bottom of the screen, to display settings -static HWND StatusBar; +// static HWND StatusBar; // have to get back to the menus to gray/ungray, check/uncheck things -static HMENU FileMenu; -static HMENU EditMenu; -static HMENU InstructionMenu; -static HMENU ProcessorMenu; -static HMENU SimulateMenu; -static HMENU TopMenu; +// static HMENU FileMenu; +// static HMENU EditMenu; +// static HMENU InstructionMenu; +// static HMENU ProcessorMenu; +// static HMENU SimulateMenu; +// static HMENU TopMenu; // listview used to maintain the list of I/O pins with symbolic names, plus // the internal relay too -HWND IoList; +// HWND IoList; static int IoListSelectionPoint; static BOOL IoListOutOfSync; int IoListHeight; @@ -247,7 +247,6 @@ void UpdateMainWindowTitleBar(void) } gtk_window_set_title (GTK_WINDOW (window), line); - } //----------------------------------------------------------------------------- @@ -258,66 +257,66 @@ void SetMenusEnabled(BOOL canNegate, BOOL canNormal, BOOL canResetOnly, BOOL canSetOnly, BOOL canDelete, BOOL canInsertEnd, BOOL canInsertOther, BOOL canPushDown, BOOL canPushUp, BOOL canInsertComment) { - EnableMenuItem(EditMenu, MNU_PUSH_RUNG_UP, - canPushUp ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(EditMenu, MNU_PUSH_RUNG_DOWN, - canPushDown ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(EditMenu, MNU_DELETE_RUNG, - (Prog.numRungs > 1) ? MF_ENABLED : MF_GRAYED); - - EnableMenuItem(InstructionMenu, MNU_NEGATE, - canNegate ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(InstructionMenu, MNU_MAKE_NORMAL, - canNormal ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(InstructionMenu, MNU_MAKE_RESET_ONLY, - canResetOnly ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(InstructionMenu, MNU_MAKE_SET_ONLY, - canSetOnly ? MF_ENABLED : MF_GRAYED); - - EnableMenuItem(InstructionMenu, MNU_INSERT_COMMENT, - canInsertComment ? MF_ENABLED : MF_GRAYED); - - EnableMenuItem(EditMenu, MNU_DELETE_ELEMENT, - canDelete ? MF_ENABLED : MF_GRAYED); - - int t; - t = canInsertEnd ? MF_ENABLED : MF_GRAYED; - EnableMenuItem(InstructionMenu, MNU_INSERT_COIL, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_RES, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_MOV, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_ADD, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_SUB, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_MUL, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_DIV, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_CTC, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_PERSIST, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_READ_ADC, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_SET_PWM, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_MASTER_RLY, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_SHIFT_REG, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_LUT, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_PWL, t); - - t = canInsertOther ? MF_ENABLED : MF_GRAYED; - EnableMenuItem(InstructionMenu, MNU_INSERT_TON, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_TOF, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_OSR, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_OSF, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_RTO, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_CONTACTS, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_CTU, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_CTD, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_EQU, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_NEQ, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_GRT, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_GEQ, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_LES, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_LEQ, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_SHORT, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_OPEN, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_UART_SEND, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_UART_RECV, t); - EnableMenuItem(InstructionMenu, MNU_INSERT_FMTD_STR, t); + // EnableMenuItem(EditMenu, MNU_PUSH_RUNG_UP, + // canPushUp ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(EditMenu, MNU_PUSH_RUNG_DOWN, + // canPushDown ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(EditMenu, MNU_DELETE_RUNG, + // (Prog.numRungs > 1) ? MF_ENABLED : MF_GRAYED); + + // EnableMenuItem(InstructionMenu, MNU_NEGATE, + // canNegate ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(InstructionMenu, MNU_MAKE_NORMAL, + // canNormal ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(InstructionMenu, MNU_MAKE_RESET_ONLY, + // canResetOnly ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(InstructionMenu, MNU_MAKE_SET_ONLY, + // canSetOnly ? MF_ENABLED : MF_GRAYED); + + // EnableMenuItem(InstructionMenu, MNU_INSERT_COMMENT, + // canInsertComment ? MF_ENABLED : MF_GRAYED); + + // EnableMenuItem(EditMenu, MNU_DELETE_ELEMENT, + // canDelete ? MF_ENABLED : MF_GRAYED); + + // int t; + // t = canInsertEnd ? MF_ENABLED : MF_GRAYED; + // EnableMenuItem(InstructionMenu, MNU_INSERT_COIL, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_RES, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_MOV, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_ADD, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_SUB, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_MUL, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_DIV, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_CTC, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_PERSIST, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_READ_ADC, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_SET_PWM, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_MASTER_RLY, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_SHIFT_REG, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_LUT, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_PWL, t); + + // t = canInsertOther ? MF_ENABLED : MF_GRAYED; + // EnableMenuItem(InstructionMenu, MNU_INSERT_TON, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_TOF, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_OSR, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_OSF, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_RTO, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_CONTACTS, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_CTU, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_CTD, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_EQU, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_NEQ, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_GRT, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_GEQ, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_LES, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_LEQ, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_SHORT, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_OPEN, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_UART_SEND, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_UART_RECV, t); + // EnableMenuItem(InstructionMenu, MNU_INSERT_FMTD_STR, t); } //----------------------------------------------------------------------------- @@ -325,15 +324,14 @@ void SetMenusEnabled(BOOL canNegate, BOOL canNormal, BOOL canResetOnly, //----------------------------------------------------------------------------- void SetUndoEnabled(BOOL undoEnabled, BOOL redoEnabled) { - EnableMenuItem(EditMenu, MNU_UNDO, undoEnabled ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(EditMenu, MNU_REDO, redoEnabled ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(EditMenu, MNU_UNDO, undoEnabled ? MF_ENABLED : MF_GRAYED); + // EnableMenuItem(EditMenu, MNU_REDO, redoEnabled ? MF_ENABLED : MF_GRAYED); } //----------------------------------------------------------------------------- // Create the top-level menu bar for the main window. Mostly static, but we // create the "select processor" menu from the list in mcutable.h dynamically. //----------------------------------------------------------------------------- - HMENU MakeMainWindowMenus(void) { HMENU MenuBox; // Box for alignment @@ -613,29 +611,29 @@ HMENU MakeMainWindowMenus(void) //----------------------------------------------------------------------------- void RefreshScrollbars(void) { - SCROLLINFO vert, horiz; - SetUpScrollbars(&NeedHoriz, &horiz, &vert); - SetScrollInfo(HorizScrollBar, SB_CTL, &horiz, TRUE); - SetScrollInfo(VertScrollBar, SB_CTL, &vert, TRUE); - - RECT main; - GetClientRect(MainWindow, &main); - - if(NeedHoriz) { - MoveWindow(HorizScrollBar, 0, IoListTop - ScrollHeight - 2, - main.right - ScrollWidth - 2, ScrollHeight, TRUE); - ShowWindow(HorizScrollBar, SW_SHOW); - EnableWindow(HorizScrollBar, TRUE); - } else { - ShowWindow(HorizScrollBar, SW_HIDE); - } - MoveWindow(VertScrollBar, main.right - ScrollWidth - 2, 1, ScrollWidth, - NeedHoriz ? (IoListTop - ScrollHeight - 4) : (IoListTop - 3), TRUE); - - MoveWindow(VertScrollBar, main.right - ScrollWidth - 2, 1, ScrollWidth, - NeedHoriz ? (IoListTop - ScrollHeight - 4) : (IoListTop - 3), TRUE); - - InvalidateRect(MainWindow, NULL, FALSE); + // SCROLLINFO vert, horiz; + // SetUpScrollbars(&NeedHoriz, &horiz, &vert); + // SetScrollInfo(HorizScrollBar, SB_CTL, &horiz, TRUE); + // SetScrollInfo(VertScrollBar, SB_CTL, &vert, TRUE); + + // RECT main; + // GetClientRect(MainWindow, &main); + + // if(NeedHoriz) { + // MoveWindow(HorizScrollBar, 0, IoListTop - ScrollHeight - 2, + // main.right - ScrollWidth - 2, ScrollHeight, TRUE); + // ShowWindow(HorizScrollBar, SW_SHOW); + // EnableWindow(HorizScrollBar, TRUE); + // } else { + // ShowWindow(HorizScrollBar, SW_HIDE); + // } + // MoveWindow(VertScrollBar, main.right - ScrollWidth - 2, 1, ScrollWidth, + // NeedHoriz ? (IoListTop - ScrollHeight - 4) : (IoListTop - 3), TRUE); + + // MoveWindow(VertScrollBar, main.right - ScrollWidth - 2, 1, ScrollWidth, + // NeedHoriz ? (IoListTop - ScrollHeight - 4) : (IoListTop - 3), TRUE); + + // InvalidateRect(MainWindow, NULL, FALSE); } //----------------------------------------------------------------------------- @@ -644,44 +642,44 @@ void RefreshScrollbars(void) //----------------------------------------------------------------------------- void VscrollProc(WPARAM wParam) { - int prevY = ScrollYOffset; - switch(LOWORD(wParam)) { - case SB_LINEUP: - case SB_PAGEUP: - if(ScrollYOffset > 0) { - ScrollYOffset--; - } - break; - - case SB_LINEDOWN: - case SB_PAGEDOWN: - if(ScrollYOffset < ScrollYOffsetMax) { - ScrollYOffset++; - } - break; - - case SB_TOP: - ScrollYOffset = 0; - break; - - case SB_BOTTOM: - ScrollYOffset = ScrollYOffsetMax; - break; - - case SB_THUMBTRACK: - case SB_THUMBPOSITION: - ScrollYOffset = HIWORD(wParam); - break; - } - if(prevY != ScrollYOffset) { - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - si.nPos = ScrollYOffset; - SetScrollInfo(VertScrollBar, SB_CTL, &si, TRUE); - - InvalidateRect(MainWindow, NULL, FALSE); - } + // int prevY = ScrollYOffset; + // switch(LOWORD(wParam)) { + // case SB_LINEUP: + // case SB_PAGEUP: + // if(ScrollYOffset > 0) { + // ScrollYOffset--; + // } + // break; + + // case SB_LINEDOWN: + // case SB_PAGEDOWN: + // if(ScrollYOffset < ScrollYOffsetMax) { + // ScrollYOffset++; + // } + // break; + + // case SB_TOP: + // ScrollYOffset = 0; + // break; + + // case SB_BOTTOM: + // ScrollYOffset = ScrollYOffsetMax; + // break; + + // case SB_THUMBTRACK: + // case SB_THUMBPOSITION: + // ScrollYOffset = HIWORD(wParam); + // break; + // } + // if(prevY != ScrollYOffset) { + // SCROLLINFO si; + // si.cbSize = sizeof(si); + // si.fMask = SIF_POS; + // si.nPos = ScrollYOffset; + // SetScrollInfo(VertScrollBar, SB_CTL, &si, TRUE); + + // InvalidateRect(MainWindow, NULL, FALSE); + // } } //----------------------------------------------------------------------------- @@ -690,50 +688,50 @@ void VscrollProc(WPARAM wParam) //----------------------------------------------------------------------------- void HscrollProc(WPARAM wParam) { - int prevX = ScrollXOffset; - switch(LOWORD(wParam)) { - case SB_LINEUP: - ScrollXOffset -= FONT_WIDTH; - break; - - case SB_PAGEUP: - ScrollXOffset -= POS_WIDTH*FONT_WIDTH; - break; - - case SB_LINEDOWN: - ScrollXOffset += FONT_WIDTH; - break; - - case SB_PAGEDOWN: - ScrollXOffset += POS_WIDTH*FONT_WIDTH; - break; - - case SB_TOP: - ScrollXOffset = 0; - break; - - case SB_BOTTOM: - ScrollXOffset = ScrollXOffsetMax; - break; - - case SB_THUMBTRACK: - case SB_THUMBPOSITION: - ScrollXOffset = HIWORD(wParam); - break; - } - - if(ScrollXOffset > ScrollXOffsetMax) ScrollXOffset = ScrollXOffsetMax; - if(ScrollXOffset < 0) ScrollXOffset = 0; - - if(prevX != ScrollXOffset) { - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - si.nPos = ScrollXOffset; - SetScrollInfo(HorizScrollBar, SB_CTL, &si, TRUE); - - InvalidateRect(MainWindow, NULL, FALSE); - } + // int prevX = ScrollXOffset; + // switch(LOWORD(wParam)) { + // case SB_LINEUP: + // ScrollXOffset -= FONT_WIDTH; + // break; + + // case SB_PAGEUP: + // ScrollXOffset -= POS_WIDTH*FONT_WIDTH; + // break; + + // case SB_LINEDOWN: + // ScrollXOffset += FONT_WIDTH; + // break; + + // case SB_PAGEDOWN: + // ScrollXOffset += POS_WIDTH*FONT_WIDTH; + // break; + + // case SB_TOP: + // ScrollXOffset = 0; + // break; + + // case SB_BOTTOM: + // ScrollXOffset = ScrollXOffsetMax; + // break; + + // case SB_THUMBTRACK: + // case SB_THUMBPOSITION: + // ScrollXOffset = HIWORD(wParam); + // break; + // } + + // if(ScrollXOffset > ScrollXOffsetMax) ScrollXOffset = ScrollXOffsetMax; + // if(ScrollXOffset < 0) ScrollXOffset = 0; + + // if(prevX != ScrollXOffset) { + // SCROLLINFO si; + // si.cbSize = sizeof(si); + // si.fMask = SIF_POS; + // si.nPos = ScrollXOffset; + // SetScrollInfo(HorizScrollBar, SB_CTL, &si, TRUE); + + // InvalidateRect(MainWindow, NULL, FALSE); + // } } //----------------------------------------------------------------------------- @@ -744,72 +742,72 @@ void HscrollProc(WPARAM wParam) //----------------------------------------------------------------------------- void RefreshControlsToSettings(void) { - int i; - - if(!IoListOutOfSync) { - IoListSelectionPoint = -1; - for(i = 0; i < Prog.io.count; i++) { - if(ListView_GetItemState(IoList, i, LVIS_SELECTED)) { - IoListSelectionPoint = i; - break; - } - } - } - - ListView_DeleteAllItems(IoList); - for(i = 0; i < Prog.io.count; i++) { - LVITEM lvi; - lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; - lvi.state = lvi.stateMask = 0; - lvi.iItem = i; - lvi.iSubItem = 0; - lvi.pszText = LPSTR_TEXTCALLBACK; - lvi.lParam = i; - - if(ListView_InsertItem(IoList, &lvi) < 0) oops(); - } - if(IoListSelectionPoint >= 0) { - for(i = 0; i < Prog.io.count; i++) { - ListView_SetItemState(IoList, i, 0, LVIS_SELECTED); - } - ListView_SetItemState(IoList, IoListSelectionPoint, LVIS_SELECTED, - LVIS_SELECTED); - ListView_EnsureVisible(IoList, IoListSelectionPoint, FALSE); - } - IoListOutOfSync = FALSE; - - if(Prog.mcu) { - SendMessage(StatusBar, SB_SETTEXT, 0, (LPARAM)Prog.mcu->mcuName); - } else { - SendMessage(StatusBar, SB_SETTEXT, 0, (LPARAM)_("no MCU selected")); - } - char buf[256]; - sprintf(buf, _("cycle time %.2f ms"), (double)Prog.cycleTime/1000.0); - SendMessage(StatusBar, SB_SETTEXT, 1, (LPARAM)buf); - - if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || - Prog.mcu->whichIsa == ISA_INTERPRETED)) - { - strcpy(buf, ""); - } else { - sprintf(buf, _("processor clock %.4f MHz"), - (double)Prog.mcuClock/1000000.0); - } - SendMessage(StatusBar, SB_SETTEXT, 2, (LPARAM)buf); - - for(i = 0; i < NUM_SUPPORTED_MCUS; i++) { - if(&SupportedMcus[i] == Prog.mcu) { - CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_CHECKED); - } else { - CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_UNCHECKED); - } - } - // `(no microcontroller)' setting - if(!Prog.mcu) { - CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_CHECKED); - } else { - CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_UNCHECKED); - } + // int i; + + // if(!IoListOutOfSync) { + // IoListSelectionPoint = -1; + // for(i = 0; i < Prog.io.count; i++) { + // if(ListView_GetItemState(IoList, i, LVIS_SELECTED)) { + // IoListSelectionPoint = i; + // break; + // } + // } + // } + + // ListView_DeleteAllItems(IoList); + // for(i = 0; i < Prog.io.count; i++) { + // LVITEM lvi; + // lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; + // lvi.state = lvi.stateMask = 0; + // lvi.iItem = i; + // lvi.iSubItem = 0; + // lvi.pszText = LPSTR_TEXTCALLBACK; + // lvi.lParam = i; + + // if(ListView_InsertItem(IoList, &lvi) < 0) oops(); + // } + // if(IoListSelectionPoint >= 0) { + // for(i = 0; i < Prog.io.count; i++) { + // ListView_SetItemState(IoList, i, 0, LVIS_SELECTED); + // } + // ListView_SetItemState(IoList, IoListSelectionPoint, LVIS_SELECTED, + // LVIS_SELECTED); + // ListView_EnsureVisible(IoList, IoListSelectionPoint, FALSE); + // } + // IoListOutOfSync = FALSE; + + // if(Prog.mcu) { + // SendMessage(StatusBar, SB_SETTEXT, 0, (LPARAM)Prog.mcu->mcuName); + // } else { + // SendMessage(StatusBar, SB_SETTEXT, 0, (LPARAM)_("no MCU selected")); + // } + // char buf[256]; + // sprintf(buf, _("cycle time %.2f ms"), (double)Prog.cycleTime/1000.0); + // SendMessage(StatusBar, SB_SETTEXT, 1, (LPARAM)buf); + + // if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || + // Prog.mcu->whichIsa == ISA_INTERPRETED)) + // { + // strcpy(buf, ""); + // } else { + // sprintf(buf, _("processor clock %.4f MHz"), + // (double)Prog.mcuClock/1000000.0); + // } + // SendMessage(StatusBar, SB_SETTEXT, 2, (LPARAM)buf); + + // for(i = 0; i < NUM_SUPPORTED_MCUS; i++) { + // if(&SupportedMcus[i] == Prog.mcu) { + // CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_CHECKED); + // } else { + // CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_UNCHECKED); + // } + // } + // // `(no microcontroller)' setting + // if(!Prog.mcu) { + // CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_CHECKED); + // } else { + // CheckMenuItem(ProcessorMenu, MNU_PROCESSOR_0+i, MF_UNCHECKED); + // } } //----------------------------------------------------------------------------- @@ -844,32 +842,32 @@ void GenerateIoListDontLoseSelection(void) //----------------------------------------------------------------------------- void MainWindowResized(void) { - RECT main; - GetClientRect(MainWindow, &main); - - RECT status; - GetWindowRect(StatusBar, &status); - int statusHeight = status.bottom - status.top; - - MoveWindow(StatusBar, 0, main.bottom - statusHeight, main.right, - statusHeight, TRUE); - - // Make sure that the I/O list can't disappear entirely. - if(IoListHeight < 30) { - IoListHeight = 30; - } - IoListTop = main.bottom - IoListHeight - statusHeight; - // Make sure that we can't drag the top of the I/O list above the - // bottom of the menu bar, because it then becomes inaccessible. - if(IoListTop < 5) { - IoListHeight = main.bottom - statusHeight - 5; - IoListTop = main.bottom - IoListHeight - statusHeight; - } - MoveWindow(IoList, 0, IoListTop, main.right, IoListHeight, TRUE); - - RefreshScrollbars(); - - InvalidateRect(MainWindow, NULL, FALSE); + // RECT main; + // GetClientRect(MainWindow, &main); + + // RECT status; + // GetWindowRect(StatusBar, &status); + // int statusHeight = status.bottom - status.top; + + // MoveWindow(StatusBar, 0, main.bottom - statusHeight, main.right, + // statusHeight, TRUE); + + // // Make sure that the I/O list can't disappear entirely. + // if(IoListHeight < 30) { + // IoListHeight = 30; + // } + // IoListTop = main.bottom - IoListHeight - statusHeight; + // // Make sure that we can't drag the top of the I/O list above the + // // bottom of the menu bar, because it then becomes inaccessible. + // if(IoListTop < 5) { + // IoListHeight = main.bottom - statusHeight - 5; + // IoListTop = main.bottom - IoListHeight - statusHeight; + // } + // MoveWindow(IoList, 0, IoListTop, main.right, IoListHeight, TRUE); + + // RefreshScrollbars(); + + // InvalidateRect(MainWindow, NULL, FALSE); } //----------------------------------------------------------------------------- @@ -878,62 +876,62 @@ void MainWindowResized(void) //----------------------------------------------------------------------------- void ToggleSimulationMode(void) { - InSimulationMode = !InSimulationMode; - - if(InSimulationMode) { - EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_ENABLED); - EnableMenuItem(SimulateMenu, MNU_SINGLE_CYCLE, MF_ENABLED); - - EnableMenuItem(FileMenu, MNU_OPEN, MF_GRAYED); - EnableMenuItem(FileMenu, MNU_SAVE, MF_GRAYED); - EnableMenuItem(FileMenu, MNU_SAVE_AS, MF_GRAYED); - EnableMenuItem(FileMenu, MNU_NEW, MF_GRAYED); - EnableMenuItem(FileMenu, MNU_EXPORT, MF_GRAYED); - - EnableMenuItem(TopMenu, 1, MF_GRAYED | MF_BYPOSITION); - EnableMenuItem(TopMenu, 2, MF_GRAYED | MF_BYPOSITION); - EnableMenuItem(TopMenu, 3, MF_GRAYED | MF_BYPOSITION); - EnableMenuItem(TopMenu, 5, MF_GRAYED | MF_BYPOSITION); + // InSimulationMode = !InSimulationMode; + + // if(InSimulationMode) { + // EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_ENABLED); + // EnableMenuItem(SimulateMenu, MNU_SINGLE_CYCLE, MF_ENABLED); + + // EnableMenuItem(FileMenu, MNU_OPEN, MF_GRAYED); + // EnableMenuItem(FileMenu, MNU_SAVE, MF_GRAYED); + // EnableMenuItem(FileMenu, MNU_SAVE_AS, MF_GRAYED); + // EnableMenuItem(FileMenu, MNU_NEW, MF_GRAYED); + // EnableMenuItem(FileMenu, MNU_EXPORT, MF_GRAYED); + + // EnableMenuItem(TopMenu, 1, MF_GRAYED | MF_BYPOSITION); + // EnableMenuItem(TopMenu, 2, MF_GRAYED | MF_BYPOSITION); + // EnableMenuItem(TopMenu, 3, MF_GRAYED | MF_BYPOSITION); + // EnableMenuItem(TopMenu, 5, MF_GRAYED | MF_BYPOSITION); - CheckMenuItem(SimulateMenu, MNU_SIMULATION_MODE, MF_CHECKED); - - ClearSimulationData(); - // Recheck InSimulationMode, because there could have been a compile - // error, which would have kicked us out of simulation mode. - if(UartFunctionUsed() && InSimulationMode) { - ShowUartSimulationWindow(); - } - } else { - RealTimeSimulationRunning = FALSE; - KillTimer(MainWindow, TIMER_SIMULATE); - - EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_GRAYED); - EnableMenuItem(SimulateMenu, MNU_STOP_SIMULATION, MF_GRAYED); - EnableMenuItem(SimulateMenu, MNU_SINGLE_CYCLE, MF_GRAYED); - - EnableMenuItem(FileMenu, MNU_OPEN, MF_ENABLED); - EnableMenuItem(FileMenu, MNU_SAVE, MF_ENABLED); - EnableMenuItem(FileMenu, MNU_SAVE_AS, MF_ENABLED); - EnableMenuItem(FileMenu, MNU_NEW, MF_ENABLED); - EnableMenuItem(FileMenu, MNU_EXPORT, MF_ENABLED); - - EnableMenuItem(TopMenu, 1, MF_ENABLED | MF_BYPOSITION); - EnableMenuItem(TopMenu, 2, MF_ENABLED | MF_BYPOSITION); - EnableMenuItem(TopMenu, 3, MF_ENABLED | MF_BYPOSITION); - EnableMenuItem(TopMenu, 5, MF_ENABLED | MF_BYPOSITION); - - CheckMenuItem(SimulateMenu, MNU_SIMULATION_MODE, MF_UNCHECKED); - - if(UartFunctionUsed()) { - DestroyUartSimulationWindow(); - } - } - - UpdateMainWindowTitleBar(); - - DrawMenuBar(MainWindow); - InvalidateRect(MainWindow, NULL, FALSE); - ListView_RedrawItems(IoList, 0, Prog.io.count - 1); + // CheckMenuItem(SimulateMenu, MNU_SIMULATION_MODE, MF_CHECKED); + + // ClearSimulationData(); + // // Recheck InSimulationMode, because there could have been a compile + // // error, which would have kicked us out of simulation mode. + // if(UartFunctionUsed() && InSimulationMode) { + // ShowUartSimulationWindow(); + // } + // } else { + // RealTimeSimulationRunning = FALSE; + // KillTimer(MainWindow, TIMER_SIMULATE); + + // EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_GRAYED); + // EnableMenuItem(SimulateMenu, MNU_STOP_SIMULATION, MF_GRAYED); + // EnableMenuItem(SimulateMenu, MNU_SINGLE_CYCLE, MF_GRAYED); + + // EnableMenuItem(FileMenu, MNU_OPEN, MF_ENABLED); + // EnableMenuItem(FileMenu, MNU_SAVE, MF_ENABLED); + // EnableMenuItem(FileMenu, MNU_SAVE_AS, MF_ENABLED); + // EnableMenuItem(FileMenu, MNU_NEW, MF_ENABLED); + // EnableMenuItem(FileMenu, MNU_EXPORT, MF_ENABLED); + + // EnableMenuItem(TopMenu, 1, MF_ENABLED | MF_BYPOSITION); + // EnableMenuItem(TopMenu, 2, MF_ENABLED | MF_BYPOSITION); + // EnableMenuItem(TopMenu, 3, MF_ENABLED | MF_BYPOSITION); + // EnableMenuItem(TopMenu, 5, MF_ENABLED | MF_BYPOSITION); + + // CheckMenuItem(SimulateMenu, MNU_SIMULATION_MODE, MF_UNCHECKED); + + // if(UartFunctionUsed()) { + // DestroyUartSimulationWindow(); + // } + // } + + // UpdateMainWindowTitleBar(); + + // DrawMenuBar(MainWindow); + // InvalidateRect(MainWindow, NULL, FALSE); + // ListView_RedrawItems(IoList, 0, Prog.io.count - 1); } //----------------------------------------------------------------------------- @@ -942,11 +940,11 @@ void ToggleSimulationMode(void) //----------------------------------------------------------------------------- void StartSimulation(void) { - RealTimeSimulationRunning = TRUE; - EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_GRAYED); - EnableMenuItem(SimulateMenu, MNU_STOP_SIMULATION, MF_ENABLED); - StartSimulationTimer(); - UpdateMainWindowTitleBar(); + // RealTimeSimulationRunning = TRUE; + // EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_GRAYED); + // EnableMenuItem(SimulateMenu, MNU_STOP_SIMULATION, MF_ENABLED); + // StartSimulationTimer(); + // UpdateMainWindowTitleBar(); } //----------------------------------------------------------------------------- @@ -955,11 +953,11 @@ void StartSimulation(void) //----------------------------------------------------------------------------- void StopSimulation(void) { - RealTimeSimulationRunning = FALSE; + // RealTimeSimulationRunning = FALSE; - EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_ENABLED); - EnableMenuItem(SimulateMenu, MNU_STOP_SIMULATION, MF_GRAYED); - KillTimer(MainWindow, TIMER_SIMULATE); + // EnableMenuItem(SimulateMenu, MNU_START_SIMULATION, MF_ENABLED); + // EnableMenuItem(SimulateMenu, MNU_STOP_SIMULATION, MF_GRAYED); + // KillTimer(MainWindow, TIMER_SIMULATE); - UpdateMainWindowTitleBar(); + // UpdateMainWindowTitleBar(); } diff --git a/ldmicro/miscutil.cpp b/ldmicro/miscutil.cpp index 428e5f6..4fddcf4 100644 --- a/ldmicro/miscutil.cpp +++ b/ldmicro/miscutil.cpp @@ -20,7 +20,7 @@ // Miscellaneous utility functions that don't fit anywhere else. IHEX writing, // verified memory allocator, other junk. //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> @@ -65,19 +65,19 @@ void dbp(char *str, ...) //----------------------------------------------------------------------------- #define ATTACH_PARENT_PROCESS ((DWORD)-1) // defined in WinCon.h, but only if // _WIN32_WINNT >= 0x500 -BOOL AttachConsoleDynamic(DWORD base) -{ - typedef BOOL WINAPI fptr_acd(DWORD base); - fptr_acd *fp; +// BOOL AttachConsoleDynamic(DWORD base) +// { +// typedef BOOL WINAPI fptr_acd(DWORD base); +// fptr_acd *fp; - HMODULE hm = LoadLibrary("kernel32.dll"); - if(!hm) return FALSE; +// HMODULE hm = LoadLibrary("kernel32.dll"); +// if(!hm) return FALSE; - fp = (fptr_acd *)GetProcAddress(hm, "AttachConsole"); - if(!fp) return FALSE; +// fp = (fptr_acd *)GetProcAddress(hm, "AttachConsole"); +// if(!fp) return FALSE; - return fp(base); -} +// return fp(base); +// } //----------------------------------------------------------------------------- // For error messages to the user; printf-like, to a message box. @@ -88,20 +88,19 @@ void Error(char *str, ...) char buf[1024]; va_start(f, str); vsprintf(buf, str, f); + va_end(f); if(RunningInBatchMode) { + printf("print batch mode"); /* Only required for windows * AttachConsoleDynamic(ATTACH_PARENT_PROCESS); */ // Indicate that it's an error, plus the output filename - printf("compile error ('%s'): ", CurrentCompileFile); - // The error message itself - printf(buf); - // And an extra newline to be safe. - strcpy(str, "\n"); - printf(str); + printf("compile error ('%s'): \n", CurrentCompileFile); + // The error message itself and an extra newline to be safe. + printf("%s\n", buf); } else { - HWND h = GetForegroundWindow(); - MessageBox(h, buf, _("LDmicro Error"), MB_OK | MB_ICONERROR); + //HWND h = GetForegroundWindow(); + //MessageBox(h, buf, _("LDmicro Error"), MB_OK | MB_ICONERROR); } } @@ -113,12 +112,12 @@ void CompileSuccessfulMessage(char *str) { if(RunningInBatchMode) { char str[MAX_PATH+100]; - sprintf(str, "compiled okay, wrote '%s'\n", CurrentCompileFile); + printf("compiled okay, wrote '%s'\n", CurrentCompileFile); - AttachConsoleDynamic(ATTACH_PARENT_PROCESS); - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD written; - WriteFile(h, str, strlen(str), &written, NULL); + //AttachConsoleDynamic(ATTACH_PARENT_PROCESS); + //HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + //DWORD written; + //riteFile(h, str, strlen(str), &written, NULL); } else { MessageBox(MainWindow, str, _("Compile Successful"), MB_OK | MB_ICONINFORMATION); @@ -146,11 +145,11 @@ void CheckHeap(char *file, int line) SkippedCalls = 0; LastCallTime = now; - if(!HeapValidate(MainHeap, 0, NULL)) { - dbp("file %s line %d", file, line); - Error("Noticed memory corruption at file '%s' line %d.", file, line); - oops(); - } + // if(!HeapValidate(MainHeap, 0, NULL)) { + // dbp("file %s line %d", file, line); + // Error("Noticed memory corruption at file '%s' line %d.", file, line); + // oops(); + // } } //----------------------------------------------------------------------------- @@ -207,17 +206,17 @@ HWND CreateWindowClient(DWORD exStyle, char *className, char *windowName, DWORD style, int x, int y, int width, int height, HWND parent, HMENU menu, HINSTANCE instance, void *param) { - HWND h = CreateWindowEx(exStyle, className, windowName, style, x, y, - width, height, parent, menu, instance, param); + // HWND h = CreateWindowEx(exStyle, className, windowName, style, x, y, + // width, height, parent, menu, instance, param); - RECT r; - GetClientRect(h, &r); - width = width - (r.right - width); - height = height - (r.bottom - height); + // RECT r; + // GetClientRect(h, &r); + // width = width - (r.right - width); + // height = height - (r.bottom - height); - SetWindowPos(h, HWND_TOP, x, y, width, height, 0); + // SetWindowPos(h, HWND_TOP, x, y, width, height, 0); - return h; + return NULL; } //----------------------------------------------------------------------------- @@ -227,30 +226,30 @@ HWND CreateWindowClient(DWORD exStyle, char *className, char *windowName, static LRESULT CALLBACK DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) { - case WM_NOTIFY: - break; - - case WM_COMMAND: { - HWND h = (HWND)lParam; - if(h == OkButton && wParam == BN_CLICKED) { - DialogDone = TRUE; - } else if(h == CancelButton && wParam == BN_CLICKED) { - DialogDone = TRUE; - DialogCancel = TRUE; - } - break; - } - - case WM_CLOSE: - case WM_DESTROY: - DialogDone = TRUE; - DialogCancel = TRUE; - break; - - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } + // switch (msg) { + // case WM_NOTIFY: + // break; + + // case WM_COMMAND: { + // HWND h = (HWND)lParam; + // if(h == OkButton && wParam == BN_CLICKED) { + // DialogDone = TRUE; + // } else if(h == CancelButton && wParam == BN_CLICKED) { + // DialogDone = TRUE; + // DialogCancel = TRUE; + // } + // break; + // } + + // case WM_CLOSE: + // case WM_DESTROY: + // DialogDone = TRUE; + // DialogCancel = TRUE; + // break; + + // default: + // return DefWindowProc(hwnd, msg, wParam, lParam); + // } return 1; } @@ -262,7 +261,7 @@ static LRESULT CALLBACK DialogProc(HWND hwnd, UINT msg, WPARAM wParam, //----------------------------------------------------------------------------- void NiceFont(HWND h) { - SendMessage(h, WM_SETFONT, (WPARAM)MyNiceFont, TRUE); +// SendMessage(h, WM_SETFONT, (WPARAM)MyNiceFont, TRUE); } //----------------------------------------------------------------------------- @@ -271,7 +270,7 @@ void NiceFont(HWND h) //----------------------------------------------------------------------------- void FixedFont(HWND h) { - SendMessage(h, WM_SETFONT, (WPARAM)MyFixedFont, TRUE); + // SendMessage(h, WM_SETFONT, (WPARAM)MyFixedFont, TRUE); } //----------------------------------------------------------------------------- @@ -279,36 +278,36 @@ void FixedFont(HWND h) //----------------------------------------------------------------------------- void MakeDialogBoxClass(void) { - WNDCLASSEX wc; - memset(&wc, 0, sizeof(wc)); - wc.cbSize = sizeof(wc); - - wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | - CS_DBLCLKS; - wc.lpfnWndProc = (WNDPROC)DialogProc; - wc.hInstance = Instance; - wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; - wc.lpszClassName = "LDmicroDialog"; - wc.lpszMenuName = NULL; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hIcon = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), - IMAGE_ICON, 32, 32, 0); - wc.hIconSm = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), - IMAGE_ICON, 16, 16, 0); - - RegisterClassEx(&wc); - - MyNiceFont = CreateFont(16, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, - FF_DONTCARE, "Tahoma"); - if(!MyNiceFont) - MyNiceFont = (HFONT)GetStockObject(SYSTEM_FONT); - - MyFixedFont = CreateFont(14, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, - FF_DONTCARE, "Lucida Console"); - if(!MyFixedFont) - MyFixedFont = (HFONT)GetStockObject(SYSTEM_FONT); + // WNDCLASSEX wc; + // memset(&wc, 0, sizeof(wc)); + // wc.cbSize = sizeof(wc); + + // wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_OWNDC | + // CS_DBLCLKS; + // wc.lpfnWndProc = (WNDPROC)DialogProc; + // wc.hInstance = Instance; + // wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; + // wc.lpszClassName = "LDmicroDialog"; + // wc.lpszMenuName = NULL; + // wc.hCursor = LoadCursor(NULL, IDC_ARROW); + // wc.hIcon = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), + // IMAGE_ICON, 32, 32, 0); + // wc.hIconSm = (HICON)LoadImage(Instance, MAKEINTRESOURCE(4000), + // IMAGE_ICON, 16, 16, 0); + + // RegisterClassEx(&wc); + + // MyNiceFont = CreateFont(16, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, + // ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, + // FF_DONTCARE, "Tahoma"); + // if(!MyNiceFont) + // MyNiceFont = (HFONT)GetStockObject(SYSTEM_FONT); + + // MyFixedFont = CreateFont(14, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, + // ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, + // FF_DONTCARE, "Lucida Console"); + // if(!MyFixedFont) + // MyFixedFont = (HFONT)GetStockObject(SYSTEM_FONT); } //----------------------------------------------------------------------------- diff --git a/ldmicro/naminglist.cpp b/ldmicro/naminglist.cpp index 5c6f6ed..d6a7159 100644 --- a/ldmicro/naminglist.cpp +++ b/ldmicro/naminglist.cpp @@ -1,5 +1,5 @@ -#include <windows.h> -#include <commctrl.h> +#include "linuxUI.h" +//#include <commctrl.h> #include <stdio.h> #include <stdlib.h> #include <wincodec.h> diff --git a/ldmicro/obj/helptext.cpp b/ldmicro/obj/helptext.cpp new file mode 100644 index 0000000..16d60fd --- /dev/null +++ b/ldmicro/obj/helptext.cpp @@ -0,0 +1,3877 @@ +// generated by txt2c.pl from
+#include <stdlib.h>
+#ifdef LDLANG_DE
+char *HelpTextDe[] = {
+ "",
+ "EINFÜHRUNG",
+ "===========",
+ "",
+ "LDmicro erzeugt einen systemspezifischen Code für einige Microchip PIC16",
+ "und Atmel AVR Mikroprozessoren. Üblicherweise wird die Software für diese",
+ "Prozessoren in Programmsprachen, wie Assembler, C oder BASIC geschrieben.",
+ "Ein Programm, welches in einer dieser Sprachen abgefasst ist, enthält",
+ "eine Anweisungsliste. Auch sind die diese Sprachen sehr leistungsfähig",
+ "und besonders gut geeignet für die Architektur dieser Prozessoren,",
+ "welche diese Anweisungsliste intern abarbeiten.",
+ "",
+ "Programme für speicherprogrammierbare Steuerungen (SPS) andererseits,",
+ "werden oftmals im Kontaktplan (KOP = ladder logic) geschrieben.",
+ "Ein einfaches Programm, könnte wie folgt aussehen:",
+ "",
+ " || ||",
+ " || Xbutton1 Tdon Rchatter Yred ||",
+ " 1 ||-------]/[---------[TON 1.000 s]-+-------]/[--------------( )-------||",
+ " || | ||",
+ " || Xbutton2 Tdof | ||",
+ " ||-------]/[---------[TOF 2.000 s]-+ ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Rchatter Ton Tneu Rchatter ||",
+ " 2 ||-------]/[---------[TON 1.000 s]----[TOF 1.000 s]---------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " ||------[END]---------------------------------------------------------||",
+ " || ||",
+ " || ||",
+ "",
+ " (TON ist eine Anzugsverzögerung, TOF eine Abfallverzögerung.",
+ " Die --] [-- Anweisungen bedeuten Eingänge, die sich ähnlich, wie Relais-",
+ " kontakte verhalten. Die --( )-- Anweisungen bedeuten Ausgänge, die sich",
+ " ähnlich, wie Relaisspulen verhalten. Viele gute Bezugsquellen werden für",
+ " KOP im Internet oder sonst wo angeboten; Einzelheiten zu dieser speziellen",
+ " Ausführung werden weiter unten angegeben.)",
+ "",
+ "Einige Unterschiede sind jedoch offensichtlich:",
+ "",
+ "* Das Programm wird in einem grafischen Format dargestellt",
+ " und nicht mit einer aus Anweisungen bestehenden Textliste. Viele",
+ " Anwender werden dies zunächst als besser verständlich auffassen.",
+ "",
+ "* Diese Programme erscheinen wie einfachste Schaltpläne, mit",
+ " Relaiskontakten (Eingängen) and Spulen (Ausgängen). Dies ist recht",
+ " intuitiv für Programmierer, die über Kenntnisse der Theorie von",
+ " Elektroschaltplänen verfügen.",
+ "",
+ "* Der ‘ladder logic compiler’ übernimmt was wo berechnet wird.",
+ " Es ist nicht notwendig einen Code zu schreiben, um zu errechnen, wann",
+ " der Status (Zustand) der Ausgänge neu bestimmt werden muss, z.B. auf",
+ " Grund einer Änderung eines Eingangs oder Timers. Auch braucht man die",
+ " Reihenfolge der Berechnungen nicht anzugeben; die SPS-Hilfsprogramme",
+ " übernehmen dies.",
+ "",
+ "LDmicro kompiliert ‘ladder logic’ (KOP) in PIC16- oder AVR-Code.",
+ "Die folgenden Prozessoren werden unterstützt:",
+ "",
+ " * PIC16F877",
+ " * PIC16F628",
+ " * PIC16F876 (ungetestet)",
+ " * PIC16F88 (ungetestet)",
+ " * PIC16F819 (ungetestet)",
+ " * PIC16F887 (ungetestet)",
+ " * PIC16F886 (ungetestet)",
+ " * ATmega8 (ungetestet)",
+ " * ATmega16 (ungetestet)",
+ " * ATmega32 (ungetestet)",
+ " * ATmega128",
+ " * ATmega64",
+ " * ATmega162 (ungetestet)",
+ "",
+ "Es wäre einfach noch weitere AVR- oder PIC16-Prozessoren zu unterstützen,",
+ "aber ich habe keine Möglichkeit diese zu testen. Falls Sie einen",
+ "bestimmten benötigen, so nehmen Sie Kontakt mit mir auf und ich werde",
+ "sehen, was ich tun kann.",
+ "",
+ "Mit LDmicro können Sie ein Kontaktplan-Programm zeichnen bzw. entwickeln.",
+ "Auch können Sie dies in Realzeit mit Ihrem Computer simulieren. Wenn",
+ "Sie dann überzeugt sind, dass Ihr Programm korrekt ist, so können",
+ "Sie die Pins, entsprechend dem Programm als Ein- oder Ausgänge, dem",
+ "Mikroprozessor zuweisen. Nach der Zuweisung der Pins können Sie den PIC-",
+ "oder AVR-Code für Ihr Programm kompilieren. Der Compiler erzeugt eine",
+ "Hex-Datei, mit dem Sie dann Ihren Mikroprozessor programmieren. Dies",
+ "ist mit jedem PIC/AVR-Programmer möglich.",
+ "",
+ "LDmicro wurde entworfen, um in etwa mit den meisten kommerziellen",
+ "SPS-Systemen ähnlich zu sein. Es gibt einige Ausnahmen und viele Dinge",
+ "sind ohnehin kein Standard in der Industrie. Lesen Sie aufmerksam die",
+ "Beschreibung jeder Anweisung, auch wenn Ihnen diese vertraut erscheint.",
+ "Dieses Dokument setzt ein Grundwissen an Kontaktplan-Programmierung",
+ "und der Struktur von SPS-Software voraus (wie: der Ausführungszyklus,",
+ "Eingänge lesen, rechnen und Ausgänge setzen).",
+ "",
+ "",
+ "WEITERE ZIELE",
+ "=============",
+ "",
+ "Es ist auch möglich einen ANSI C - Code zu erzeugen. Diesen können",
+ "Sie dann für jeden Prozessor verwenden, für den Sie einen C-Compiler",
+ "besitzen. Sie sind dann aber selbst verantwortlich, den Ablauf zu",
+ "bestimmen. Das heißt, LDmicro erzeugt nur ein Stammprogramm für einen",
+ "Funktions- SPS-Zyklus. Sie müssen den SPS-Zyklus bei jedem Durchlauf",
+ "aufrufen und auch die Ausführung (Implementierung) der E/A-Funktionen,",
+ "die der SPS-Zyklus abruft (wie: lesen/schreiben, digitaler Eingang usw.).",
+ "Für mehr Einzelheiten: Siehe die Kommentare in dem erzeugten Quellcode.",
+ "",
+ "Ganz zuletzt kann LDmicro auch für eine virtuelle Maschine einen",
+ "prozessor-unabhängigen Byte-Code erzeugen, welche mit der KOP-Kodierung",
+ "(ladder logic) laufen soll. Ich habe eine Beispiel-Anwendung des",
+ "VM/Interpreters vorgesehen, in ziemlich gutem C geschrieben. Dieses",
+ "Anwendungsziel wird halbwegs auf jeder Plattform funktionieren, so lange",
+ "Sie Ihre eigene VM vorsehen. Dies könnte für solche Anwendungen nützlich",
+ "sein, für die Sie KOP (ladder logic) als Datentransfer-Sprache verwenden",
+ "möchten, um ein größeres Programm anzupassen. Für weitere Einzelheiten:",
+ "Siehe die Kommentare in dem Beispiel-Interpreter.",
+ "",
+ "",
+ "OPTIONEN DER BEFEHLSZEILEN ",
+ "==========================",
+ "",
+ "ldmicro.exe läuft normalerweise ohne eine Befehlszeilen-Option.",
+ "Das heißt, dass Sie nur ein Tastenkürzel zu dem Programm benötigen",
+ "oder es auf dem Desktop abspeichern und dann auf das Symbol (die Ikone)",
+ "doppelklicken, um es laufen zu lassen. Danach können Sie alles ausführen,",
+ "was das GUI (Graphical User Interface) zulässt.",
+ "",
+ "Wenn man an LDmicro einen alleinstehenden Dateinamen in der Befehlszeile",
+ "vergeben hat (z. B. ‘ldmicro.exe asd.ld’), wird LDmicro versuchen ‘asd.ld’",
+ "zu öffnen, falls diese existiert. Dies bedeutet, dass man ldmicro.exe",
+ "mit .ld Dateien verbinden kann, sodass dies automatisch abläuft, wenn",
+ "man auf eine .ld Datei doppelklickt.",
+ "",
+ "Wenn man an LDmicro das Argument in der Befehlszeile in folgender Form",
+ "vergeben hat: ‘ldmicro.exe /c src.ld dest.hex’, so wird es versuchen",
+ "‘src.ld’ zu kompilieren und unter ‘dest.hex’ abzuspeichern. LDmicro endet",
+ "nach dem Kompilieren, unabhängig davon, ob die Kompilierung erfolgreich",
+ "war oder nicht. Alle Meldungen werden auf der Konsole ausgegeben. Dieser",
+ "Modus ist hilfreich, wenn man LDmicro von der Befehlszeile laufen",
+ "aus lässt.",
+ "",
+ "",
+ "GRUNDLAGEN",
+ "==========",
+ "",
+ "Wenn Sie LDmicro ohne Argumente aufrufen, so beginnt es als ein leeres",
+ "Programm. Wenn Sie LDmicro mit dem Namen eines ‘ladder’ (KOP)-Programms",
+ "(z.B. xxx.ld) in der Befehlszeile öffnen, dann wird es versuchen dieses",
+ "Programm am Anfang zu laden.",
+ "",
+ "LDmicro verwendet sein eigenes internes Format für das Programm und",
+ "man kann kein logisches Zeichen aus einem anderen (Fremd-)Programm",
+ "importieren.",
+ "",
+ "Falls Sie nicht ein schon vorhandenes Programm laden, dann wird Ihnen",
+ "ein Programm mit einem leeren Netzwerk geliefert. In dieses können Sie",
+ "einen Befehl einfügen; z. B. könnten Sie auch eine Reihe von Kontakten",
+ "einfügen (Anweisung -> Kontakte Einfügen), die zunächst mit ‘Xneu’",
+ "bezeichnet werden. ‘X’ bedeutet, dass der Kontakt auf einen Eingang",
+ "des Mikroprozessors festgelegt ist. Diesen Pin können Sie später zuweisen,",
+ "nachdem Sie den Mikroprozessor gewählt haben und die Kontakte",
+ "umbenannt haben. Der erste Buchstabe zeigt an, um welche Art Objekt es",
+ "sich handelt. Zum Beispiel:",
+ "",
+ " * XName -- Auf einen Eingang des Mikroprozessors festgelegt",
+ " * YName -- Auf einen Ausgang des Mikroprozessors festgelegt",
+ " * RName -- Merker: Ein Bit im Speicher (Internes Relais)",
+ " * TName -- Ein Timer; Anzugs- oder Abfallverzögerung",
+ " * CName -- Ein Zähler, Aufwärts- oder Abwärtszähler",
+ " * AName -- Eine Ganzzahl, von einem A/D-Wandler eingelesen",
+ " * Name -- Eine Allzweck-Variable als Ganzzahl",
+ "",
+ "Wählen Sie den Rest des Namens, sodass dieser beschreibt, was das Objekt",
+ "bewirkt und das dieser auch einmalig im Programm ist. Der gleiche Name",
+ "bezieht sich immer auf das gleiche Objekt im Programm. Es wäre zum",
+ "Beispiel falsch eine Anzugsverzögerung (TON) ‘TVerzög’ zu nennen und im",
+ "selben Programm eine Abfallverzögerung ‘TVerzög’ (TOF), weil jeder Zähler",
+ "(oder Timer) seinen eigenen Speicher benötigt. Andererseits wäre es",
+ "korrekt einen „Speichernden Timer“ (RTO) ‘TVerzög’ zu nennen und eine",
+ "entsprechende Rücksetz-Anweisung (RES) = ‘TVerzög’, weil in diesem",
+ "Fall beide Befehle dem gleichen Timer gelten.",
+ "",
+ "Die Namen von Variablen können aus Buchstaben, Zahlen und Unter-",
+ "strichen (_) bestehen. Der Name einer Variablen darf nicht mit einer",
+ "Nummer beginnen. Die Namen von Variablen sind fallabhängig.",
+ "",
+ "Ein Befehl für eine gewöhnliche Variable (MOV, ADD, EQU, usw.), kann",
+ "mit Variablen mit jedem Namen arbeiten. Das bedeutet, dass diese Zugang",
+ "zu den Timer- und Zähler-Akkumulatoren haben. Das kann manchmal recht",
+ "hilfreich sein; zum Beispiel kann man damit prüfen, ob die Zählung eines",
+ "Timers in einem bestimmten Bereich liegt.",
+ "",
+ "Die Variablen sind immer 16-Bit Ganzzahlen. Das heißt sie können von",
+ "-32768 bis 32767 reichen. Die Variablen werden immer als vorzeichen-",
+ "behaftet behandelt. Sie können auch Buchstaben als Dezimalzahlen festlegen",
+ "(0, 1234, -56). Auch können Sie ASCII-Zeichenwerte (‘A’, ‘z’) festlegen,",
+ "indem Sie die Zeichen in „Auslassungszeichen“ einfügen. Sie können",
+ "ein ASCII-Zeichen an den meisten Stellen verwenden, an denen Sie eine",
+ "Dezimalzahl verwenden können.",
+ "",
+ "Am unteren Ende der Maske (Bildanzeige) sehen Sie eine Liste aller",
+ "Objekte (Anweisungen, Befehle) des Programms. Diese Liste wird vom",
+ "Programm automatisch erzeugt; es besteht somit keine Notwendigkeit diese",
+ "von Hand auf dem Laufenden zu halten. Die meisten Objekte benötigen",
+ "keine Konfiguration. ‘XName’, ‘YName’, und ‘AName’ Objekte allerdings,",
+ "müssen einem Pin des Mikroprozessors zugeordnet werden. Wählen Sie zuerst",
+ "welcher Prozessor verwendet wird (Voreinstellungen -> Prozessor). Danach",
+ "legen Sie Ihre E/A Pins fest, indem Sie in der Liste auf diese jeweils",
+ "doppelklicken.",
+ "",
+ "Sie können das Programm verändern, indem Sie Anweisungen (Befehle)",
+ "einfügen oder löschen. Die Schreibmarke (cursor)im Programm blinkt,",
+ "um die momentan gewählte Anweisung und den Einfügungspunkt anzuzeigen.",
+ "Falls diese nicht blinkt, so drücken Sie den <Tabulator> oder klicken",
+ "Sie auf eine Anweisung. Jetzt können Sie die momentane Anweisung löschen",
+ "oder eine neue Anweisung einfügen; links oder rechts (in Reihenschaltung)",
+ "oder über oder unter (in Parallelschaltung) mit der gewählten Anweisung.",
+ "Einige Handhabungen sind nicht erlaubt, so zum Beispiel weitere",
+ "Anweisungen rechts von einer Spule.",
+ "",
+ "Das Programm beginnt mit nur einem Netzwerk. Sie können mehr Netzwerke",
+ "hinzufügen, indem Sie ‘Netzwerk Einfügen Davor/Danach’ im Programm-Menü",
+ "wählen. Den gleichen Effekt könnten Sie erzielen, indem Sie viele",
+ "komplizierte parallele Unterschaltungen in einem einzigen Netzwerk",
+ "unterbringen. Es ist aber übersichtlicher, mehrere Netzwerke zu verwenden.",
+ "",
+ "Wenn Sie Ihr Programm fertig geschrieben haben, so können Sie dieses",
+ "mit der Simulation testen. Danach können Sie es in eine Hex-Datei für",
+ "den zugedachten Mikroprozessor kompilieren.",
+ "",
+ "",
+ "SIMULATION",
+ "==========",
+ "",
+ "Um den Simulationsbetrieb einzugeben, wählen Sie ‘Simulieren ->",
+ "Simulationsbetrieb’ oder drücken Sie <Strg+M>. Das Programm wird",
+ "im Simulationsbetrieb unterschiedlich dargestellt. Es gibt keine",
+ "Schreibmarke (cursor) mehr. Die „erregten“ Anweisungen erscheinen hellrot,",
+ "die „nicht erregten“ erscheinen grau. Drücken Sie die Leertaste, um das",
+ "SPS-Programm nur einen einzelnen Zyklus durchlaufen zu lassen. Wählen",
+ "Sie für einen kontinuierlichen Umlauf in Echtzeit ‘Simulieren -> Start",
+ "Echtzeit-Simulation’ oder drücken Sie <Strg+R>. Die Maske (Bildanzeige)",
+ "des Programms wird jetzt in Echtzeit, entsprechend der Änderungen des",
+ "Status (des Zustands) des Programms aktualisiert.",
+ "",
+ "Sie können den Status (Zustand) eines Eingangs im Programm einstellen,",
+ "indem Sie auf den jeweiligen auf der Liste am unteren Ende der",
+ "Maske (Bildanzeige) doppelklicken oder auf die jeweilige ‘XName’",
+ "Kontakt-Anweisung im Programm. Wenn Sie den Status (Zustand) eines",
+ "Eingangs-Pins ändern, so wird diese Änderung nicht unmittelbar in",
+ "der Maske (Bildanzeige) wiedergegeben, sondern erst wenn sich die",
+ "SPS im zyklischen Umlauf befindet. Das geschieht automatisch wenn das",
+ "SPS-Programm in Echtzeit-Simulation läuft, oder wenn Sie die Leertaste",
+ "drücken.",
+ "",
+ "",
+ "KOMPILIEREN ZUM SYSTEMSPEZIFISCHEN CODE",
+ "=======================================",
+ "",
+ "Letztlich ist es dann nur sinnvoll eine .hex Datei zu erzeugen, mit",
+ "der Sie Ihren Mikroprozessor programmieren können. Zunächst müssen",
+ "Sie die Teilenummer des Mikroprozessors im Menü ‘Voreinstellungen ->",
+ "Prozessor’ wählen. Danach müssen jedem ‘XName’ oder ‘YName’ Objekt",
+ "einen E/A-Pin zuweisen. Tun Sie dies, indem auf den Namen des Objekts",
+ "doppelklicken, welcher sich in der Liste ganz unten in der Maske",
+ "(Bildanzeige) befindet. Ein Dialogfenster wird dann erscheinen und Sie",
+ "können daraufhin einen noch nicht vergebenen Pin von der Liste aussuchen.",
+ "",
+ "Als nächstes müssen Sie die Zykluszeit wählen, mit der Sie das",
+ "Programm laufen lassen wollen, auch müssen Sie dem Compiler mitteilen",
+ "mit welcher Taktgeschwindigkeit der Prozessor arbeiten soll. Diese",
+ "Einstellungen werden im Menü ‘Voreinstellungen -> Prozessor Parameter...’",
+ "vorgenommen. Üblicherweise sollten Sie die Zykluszeit nicht ändern,",
+ "denn diese ist auf 10ms voreingestellt, dies ist ein guter Wert für",
+ "die meisten Anwendungen. Tippen Sie die Frequenz des Quarzes (oder des",
+ "Keramik-Resonators) ein, mit der Sie den Prozessor betreiben wollen und",
+ "klicken auf Okay.",
+ "",
+ "Jetzt können Sie einen Code von Ihrem Programm erzeugen. Wählen Sie",
+ "‘Kompilieren -> Kompilieren’ oder ‘Kompilieren -> Kompilieren unter...’,",
+ "falls Sie vorher Ihr Programm schon kompiliert haben und einen neuen Namen",
+ "für die Ausgangsdatei vergeben wollen. Wenn Ihr Programm fehlerfrei ist,",
+ "wird LDmicro eine Intel IHEX Datei erzeugen, mit der sich Ihr Prozessor",
+ "programmieren lässt.",
+ "",
+ "Verwenden Sie hierzu irgendeine Programmier Soft- und Hardware, die Sie",
+ "besitzen, um die Hex-Datei in den Mikroprozessor zu laden. Beachten Sie",
+ "die Einstellungen für die Konfigurationsbits (fuses)! Bei den PIC16",
+ "Prozessoren sind diese Konfigurationsbits bereits in der Hex-Datei",
+ "enthalten. Die meisten Programmiersoftwares schauen automatisch nach",
+ "diesen. Für die AVR-Prozessoren müssen Sie die Konfigurationsbits von",
+ "Hand einstellen.",
+ "",
+ "",
+ "ANWEISUNGS-VERZEICHNIS",
+ "======================",
+ "",
+ "> KONTAKT, SCHLIESSER XName RName YName",
+ " ----] [---- ----] [---- ----] [----",
+ "",
+ "Wenn ein ‘unwahres’ Signal diese Anweisung erreicht, so ist das",
+ "Ausgangssignal ‘unwahr’. Wenn ein ‘wahres’ Signal diese Anweisung",
+ "erreicht, so ist das Ausgangssignal ‘wahr’. Dies nur, falls der",
+ "vorliegende Eingangspin, Ausgangspin oder eines Merkers (Hilfsrelais)",
+ "‘wahr’ ist, anderenfalls ist es unwahr. Diese Anweisung fragt den Status",
+ "(Zustand) eines Eingangspins, Ausgangspins oder Merkers (Hilfsrelais) ab.",
+ "",
+ "",
+ "> KONTAKT, ÖFFNER XName RName YName",
+ " ----]/[---- ----]/[---- ----]/[----",
+ "",
+ "Wenn ein ‘unwahres’ Signal diese Anweisung erreicht, so ist das",
+ "Ausgangssignal ‘unwahr’. Wenn ein ‘wahres’ Signal diese Anweisung",
+ "erreicht, so ist das Ausgangssignal ‘wahr’. Dies nur, falls der",
+ "vorliegende Eingangspin, Ausgangspin oder der Merker (= internes",
+ "Hilfsrelais) ‘unwahr’ ist, anderenfalls ist es ‘unwahr’. Diese Anweisung",
+ "fragt den Status (Zustand) eines Eingangspins, Ausgangspins oder Merkers",
+ "(Hilfsrelais) ab. Dies ist das Gegenteil eines Schließers.",
+ "",
+ "",
+ "> SPULE, NORMAL (MERKER,AUSGANG) RName YName",
+ " ----( )---- ----( )----",
+ "",
+ "Wenn ein ‘unwahres’ Signal diese Anweisung erreicht, so wird der",
+ "vorliegende Merker (Hilfsrelais) oder Ausgangspin nicht angesteuert. Wenn",
+ "ein ‘wahres’ Signal diese Anweisung erreicht, so wird der vorliegende",
+ "Merker (Hilfsrelais) oder Ausgangspin angesteuert. Es ist nicht sinnvoll",
+ "dieser Spule eine Eingangsvariable zuzuweisen. Diese Anweisung muss",
+ "ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> SPULE, NEGIERT (MERKER,AUSGANG) RName YName",
+ " ----(/)---- ----(/)----",
+ "",
+ "Wenn ein ‘wahres’ Signal diese Anweisung erreicht, so wird der vorliegende",
+ "Merker (Hilfsrelais)oder Ausgangspin nicht angesteuert. Wenn ein",
+ "‘unwahres’ Signal diese Anweisung erreicht, so wird der vorliegende Merker",
+ "(Hilfsrelais) oder Ausgangspin angesteuert. Es ist nicht sinnvoll dieser",
+ "Spule eine Eingangsvariable zuzuweisen. Dies ist das Gegenteil einer",
+ "normalen Spule. Diese Anweisung muss im Netzwerk ganz rechts stehen.",
+ "",
+ "",
+ "> SPULE, SETZEN RName YName",
+ " ----(S)---- ----(S)----",
+ "",
+ "Wenn ein ‘wahres’ Signal diese Anweisung erreicht, so wird der vorliegende",
+ "Merker (Hilfsrelais)oder Ausgangspin auf ‘wahr’ gesetzt. Anderenfalls",
+ "bleibt der Status (Zustand) des Merkers (Hilfsrelais) oder Ausgangspins",
+ "unverändert. Diese Anweisung kann nur den Status (Zustand) einer Spule",
+ "von ‘unwahr’ nach ‘wahr’ verändern, insofern wird diese üblicherweise in",
+ "einer Kombination mit einer Rücksetz-Anweisung für eine Spule verwendet.",
+ "Diese Anweisung muss ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> SPULE, RÜCKSETZEN RName YName",
+ " ----(R)---- ----(R)----",
+ "",
+ "Wenn ein ‘wahres’ Signal diese Anweisung erreicht, so wird der vorliegende",
+ "Merker (Hilfsrelais) oder Ausgangspin rückgesetzt. Anderenfalls bleibt der",
+ "Status (Zustand) des Merkers (Hilfsrelais) oder Ausgangspins unverändert.",
+ "Diese Anweisung kann nur den Status (Zustand) einer Spule von ‘wahr’ nach",
+ "‘unwahr’ verändern, insofern wird diese üblicherweise in einer Kombination",
+ "mit einer Setz-Anweisung für eine Spule verwendet. Diese Anweisung muss",
+ "ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> ANZUGSVERZÖGERUNG Tdon",
+ " -[TON 1.000 s]-",
+ "",
+ "Wenn ein Signal diese Anweisung erreicht, welches seinen Status",
+ "(Zustand) von ‘unwahr’ nach ‘wahr’ ändert, so bleibt das Ausgangssignal",
+ "für 1,000 s ‘unwahr’, dann wird es ‘wahr’. Wenn ein Signal diese",
+ "Anweisung erreicht, welches seinen Status (Zustand) von ‘wahr’ nach",
+ "‘unwahr’ ändert, so wird das Ausgangssignal sofort ‘unwahr’. Der Timer",
+ "wird jedes Mal rückgesetzt (bzw. auf Null gesetzt), wenn der Eingang",
+ "‘unwahr’ wird. Der Eingang muss für 1000 aufeinanderfolgende Millisekunden",
+ "‘wahr’ bleiben, bevor auch der Ausgang ‘wahr’ wird. Die Verzögerung",
+ "ist konfigurierbar.",
+ "",
+ "Die ‘TName’ Variable zählt, in der Einheit der jeweiligen Zykluszeit,",
+ "von Null ab hoch. Der Ausgang der TON-Anweisung wird wahr, wenn die",
+ "Zählervariable größer oder gleich der vorliegenden Verzögerung ist.",
+ "Es möglich die Zählervariable an einer anderen Stelle im Programm zu",
+ "bearbeiten, zum Beispiel mit einer TRANSFER-Anweisung (MOV).",
+ "",
+ "",
+ "> ABFALLVERZÖGERUNG Tdoff",
+ " -[TOF 1.000 s]-",
+ "",
+ "Wenn ein Signal diese Anweisung erreicht, welches seinen Status",
+ "(Zustand) von ‘wahr’ nach ‘unwahr’ ändert, so bleibt das Ausgangssignal",
+ "für 1,000 s ‘wahr’, dann wird es ‘unwahr’. Wenn ein Signal diese",
+ "Anweisung erreicht, welches seinen Status (Zustand) von ‘unwahr’ nach",
+ "‘wahr’ ändert, so wird das Ausgangssignal sofort ‘wahr’. Der Timer wird",
+ "jedes Mal rückgesetzt (bzw. auf Null gesetzt), wenn der Eingang ‘unwahr’",
+ "wird. Der Eingang muss für 1000 aufeinanderfolgende Millisekunden ‘unwahr’",
+ "bleiben, bevor auch der Ausgang ‘unwahr’ wird. Die Verzögerung ist",
+ "konfigurierbar.",
+ "",
+ "Die ‘TName’ Variable zählt, in der Einheit der jeweiligen Zykluszeit,",
+ "von Null ab hoch. Der Ausgang der TOF Anweisung wird wahr, wenn die",
+ "Zählervariable größer oder gleich der vorliegenden Verzögerung ist.",
+ "Es möglich die Zählervariable an einer anderen Stelle im Programm zu",
+ "bearbeiten, zum Beispiel mit einer TRANSFER-Anweisung (MOV).",
+ "",
+ "",
+ "> SPEICHERNDER TIMER Trto",
+ " -[RTO 1.000 s]-",
+ "",
+ "Diese Anweisung zeichnet auf, wie lange sein Eingang ‘wahr’ gewesen",
+ "ist. Wenn der Eingang für mindestens 1.000 s ‘wahr’ gewesen ist, dann",
+ "wird der Ausgang ‘wahr’. Andernfalls ist er ‘unwahr’. Der Eingang muss",
+ "für 1000 aufeinanderfolgende Millisekunden ‘wahr’ gewesen sein; wenn",
+ "der Eingang für 0,6 s ‘wahr’ war, dann ‘unwahr’ für 2,0 s und danach für",
+ "0,4 s wieder ‘wahr’, so wird sein Ausgang ‘wahr’. Nachdem der Ausgang",
+ "‘wahr’ wurde, so bleibt er ‘wahr’, selbst wenn der Eingang ‘unwahr’",
+ "wird, so lange der Eingang für länger als 1.000 s ‘wahr’ gewesen ist.",
+ "Der Timer muss deshalb von Hand mit Hilfe der Rücksetz-Anweisung",
+ "rückgesetzt (auf Null gesetzt) werden.",
+ "",
+ "Die ‘TName’ Variable zählt, in der Einheit der jeweiligen Zykluszeit,",
+ "von Null ab hoch. Der Ausgang der RTO-Anweisung wird wahr, wenn die",
+ "Zählervariable größer oder gleich der vorliegenden Verzögerung ist.",
+ "Es möglich die Zählervariable an einer anderen Stelle im Programm zu",
+ "bearbeiten, zum Beispiel mit einer TRANSFER-Anweisung (MOV).",
+ "",
+ "",
+ "> RÜCKSETZEN Trto Citems",
+ " ----{RES}---- ----{RES}----",
+ "",
+ "Diese Anweisung rücksetzt einen Timer oder Zähler. TON oder TOF Timer",
+ "werden automatisch rückgesetzt, wenn ihr Eingang ‘wahr’ oder ‘unwahr’",
+ "wird, somit ist die RES-Anweisung für diese Timer nicht erforderlich. RTO",
+ "Timer und CTU/CTD Zähler werden nicht automatisch rückgesetzt, somit",
+ "müssen diese von Hand mit Hilfe der RES-Anweisung rückgesetzt (auf Null)",
+ "werden. Wenn der Eingang ‘wahr’ ist, so wird der Timer oder Zähler",
+ "rückgesetzt; wenn der Eingang ‘unwahr’ ist, so erfolgt keine Aktion.",
+ "Diese Anweisung muss ganz rechts im Netzwerk stehen.",
+ "",
+ " _",
+ "> ONE-SHOT RISING, STEIGENDE FLANKE --[OSR_/ ]--",
+ "",
+ "Diese Anweisung wird normalerweise ‘unwahr’ ausgewiesen. Wenn der Eingang",
+ "der Anweisung während des momentanen Zyklus ‘wahr’ ist und während des",
+ "vorgehenden ‘unwahr’ war, so wird der Ausgang ‘wahr’. Daher erzeugt diese",
+ "Anweisung bei jeder steigenden Flanke einen Impuls für einen Zyklus.",
+ "Diese Anweisung ist hilfreich, wenn Sie Ereignisse an der steigenden",
+ "Flanke eines Signals auslösen wollen.",
+ "",
+ " _",
+ "> ONE-SHOT FALLING, FALLENDE FLANKE --[OSF \\_ ]--",
+ "",
+ "Diese Anweisung wird normalerweise ‘unwahr’ ausgewiesen. Wenn der Eingang",
+ "der Anweisung während des momentanen Zyklus ‘unwahr’ ist und während des",
+ "vorgehenden ‘wahr’ war, so wird der Ausgang ‘wahr’. Daher erzeugt diese",
+ "Anweisung bei jeder fallenden Flanke einen Impuls für einen Zyklus.",
+ "Diese Anweisung ist hilfreich, wenn Sie Ereignisse an der fallenden",
+ "Flanke eines Signals auslösen wollen.",
+ "",
+ "",
+ "> BRÜCKE, ÖFFNUNG ----+----+---- ----+ +----",
+ "",
+ "Der Eingangszustand einer Brücke ist immer gleich seinem Ausgangszustand.",
+ "Der Ausgangszustands einer Öffnung ist immer ‘unwahr’. Diese Anweisungen",
+ "sind bei der Fehlerbehebung (debugging) besonders hilfreich.",
+ "",
+ "",
+ "> MASTER CONTROL RELAIS -{MASTER RLY}-",
+ "",
+ "",
+ "Im Normalfall ist der Anfang (die linke Stromschiene) von jedem Netzwerk",
+ "‘wahr’. Wenn eine ‘Master Control Relais’ Anweisung ausgeführt wird dessen",
+ "Eingang ‘unwahr’ ist, so werden die Anfänge (die linke Stromschiene)",
+ "aller folgenden Netzwerke ‘unwahr’. Das setzt sich fort bis die nächste",
+ "‘Master Control Relais’ Anweisung erreicht wird (unabhängig von dem",
+ "Anfangszustand dieser Anweisung). Diese Anweisungen müssen daher als Paar",
+ "verwendet werden: Eine (vielleicht abhängige), um den „gegebenenfalls",
+ "gesperrten“ Abschnitt zu starten und eine weitere, um diesen zu beenden.",
+ "",
+ "",
+ "> TRANSFER, MOV {destvar := } {Tret := }",
+ " -{ 123 MOV}- -{ srcvar MOV}-",
+ "",
+ "Wenn der Eingang dieser Anweisung ‘wahr’ ist, so setzt diese die",
+ "vorliegende Zielvariable gleich der vorliegenden Quellvariablen",
+ "oder Konstanten. Wenn der Eingang dieser Anweisung ‘unwahr’ ist, so",
+ "geschieht nichts. Mit der TRANSFER-Anweisung (MOV) können Sie jede",
+ "Variable zuweisen; dies schließt Timer und Zähler Statusvariablen ein,",
+ "welche mit einem vorgestellten ‘T’ oder ‘C’ unterschieden werden. Eine",
+ "Anweisung zum Beispiel, die eine ‘0’ in einen ‘TBewahrend’ transferiert,",
+ "ist äquivalent mit einer RES-Anweisung für diesen Timer. Diese Anweisung",
+ "muss ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> ARITHMETISCHE OPERATIONEN {ADD kay :=} {SUB Ccnt :=}",
+ " -{ 'a' + 10 }- -{ Ccnt - 10 }-",
+ "",
+ "> {MUL dest :=} {DIV dv := }",
+ " -{ var * -990 }- -{ dv / -10000}-",
+ "",
+ "Wenn der Eingang einer dieser Anweisungen ‘wahr’ ist, so setzt diese",
+ "die vorliegende Zielvariable gleich dem vorliegenden arithmetischem",
+ "Ausdruck. Die Operanden können entweder Variabelen (einschließlich Timer-",
+ "und Zählervariabelen) oder Konstanten sein. Diese Anweisungen verwenden",
+ "16-Bitzeichen Mathematik. Beachten Sie, dass das Ergebnis jeden Zyklus",
+ "ausgewertet wird, wenn der Eingangszustand ‘wahr’ ist. Falls Sie eine",
+ "Variable inkrementieren oder dekrementieren (d.h., wenn die Zielvariable",
+ "ebenfalls einer der Operanden ist), dann wollen Sie dies vermutlich",
+ "nicht; normalerweise würden Sie einen Impuls (one-shot) verwenden,",
+ "sodass die Variable nur bei einer steigenden oder fallenden Flanke des",
+ "Eingangszustands ausgewertet wird. Dividieren kürzt: D.h. 8 / 3 = 2.",
+ "Diese Anweisungen müssen ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> VERGLEICHEN [var ==] [var >] [1 >=]",
+ " -[ var2 ]- -[ 1 ]- -[ Ton]-",
+ "",
+ "> [var /=] [-4 < ] [1 <=]",
+ " -[ var2 ]- -[ vartwo]- -[ Cup]-",
+ "",
+ "Wenn der Eingang dieser Anweisung ‘unwahr’ ist, so ist der Ausgang",
+ "auch ‘unwahr’. Wenn der Eingang dieser Anweisung ‘wahr’ ist, dann ist",
+ "Ausgang ‘wahr’; dies aber nur, wenn die vorliegende Bedingung ‘wahr’",
+ "ist. Diese Anweisungen können zum Vergleichen verwendet werden, wie:",
+ "Auf gleich, auf größer als, auf größer als oder gleich, auf ungleich,",
+ "auf kleiner als, auf kleiner als oder gleich, eine Variable mit einer",
+ "Variablen oder eine Variable mit einer 16-Bitzeichen-Konstanten.",
+ "",
+ "",
+ "> ZÄHLER CName CName",
+ " --[CTU >=5]-- --[CTD >=5]—",
+ "",
+ "Ein Zähler inkrementiert (CTU, aufwärtszählen) oder dekrementiert",
+ "(CTD, abwärtszählen) die bezogene Zählung bei jeder steigenden Flanke",
+ "des Eingangszustands des Netzwerks (d.h. der Eingangszustand des",
+ "Netzwerks geht von ‘unwahr’ auf ‘wahr’ über). Der Ausgangszustand des",
+ "Zählers ist ‘wahr’, wenn die Zähler- variable ist größer oder gleich 5",
+ "und andernfalls ‘unwahr’. Der Ausgangszustand des Netzwerks kann ‘wahr’",
+ "sein, selbst wenn der Eingangszustand ‘unwahr’ ist; das hängt lediglich",
+ "von Zählervariablen ab. Sie können einer CTU- und CTD-Anweisung den",
+ "gleichen Namen zuteilen, um den gleichen Zähler zu inkrementieren und",
+ "dekrementieren. Die RES-Anweisung kann einen Zähler rücksetzen oder auch",
+ "eine gewöhnliche Variablen-Operation mit der Zählervariablen ausführen.",
+ "",
+ "",
+ "> ZIRKULIERENDER ZÄHLER CName",
+ " --{CTC 0:7}--",
+ "",
+ "Ein zirkulierender Zähler arbeitet wie ein normaler CTU-Zähler, außer",
+ "nach der Erreichung seiner Obergrenze, rücksetzt er seine Zählervariable",
+ "auf Null. Zum Beispiel würde der oben gezeigte Zähler, wie folgt zählen:",
+ "0, 1, 2, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2,.... Dies ist",
+ "hilfreich in Kombination mit bedingten Anweisungen der Variablen‘CName’;",
+ "Sie können dies als eine Folgeschaltung verwenden. CTC-Zähler takten",
+ "mit der aufsteigenden Flanke der Eingangsbedingung des Netzwerks.",
+ "Diese Anweisung muss ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> SCHIEBEREGISTER {SHIFT REG }",
+ " -{ reg0..3 }-",
+ "",
+ "Ein Schieberegister besteht aus einer Reihe von Variablen. So bestünde",
+ "zum Beispiel ein Schieberegister aus den Variablen ‘reg0’, ‘reg1’,",
+ "‘reg2’, and ‘reg3’. Der Eingang des Schieberegisters ist ‘reg0’. Bei",
+ "jeder steigenden Flanke der Eingansbedingung des Netzwerks, schiebt das",
+ "Schieberegister nach rechts. Dies bedeutet es wie folgt zuweist: ‘reg3’",
+ "nach ‘reg2’, ‘reg2’ nach ‘reg1’ und ‘reg1’ nach ‘reg0’. ‘reg0’ bleibt",
+ "unverändert. Ein großes Schieberegister kann leicht viel Speicherplatz",
+ "belegen. Diese Anweisung muss ganz rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> NACHSCHLAG-TABELLE {dest := }",
+ " -{ LUT[i] }-",
+ "",
+ "Eine Nachschlag-Tabelle ist eine Anordnung von n Werten. Wenn die",
+ "Eingangsbedingung des Netzwerks ‘wahr’ ist, so wird die Ganzzahl-Variable",
+ "‘dest’ mit dem Eintrag in der Nachschlag-Tabelle gleichgesetzt, der der",
+ "Ganzzahl-Variablen ‘i’ entspricht. Das Verzeichnis beginnt bei Null,",
+ "insofern muss sich ‘i’ zwischen 0 und (n-1) befinden. Das Verhalten",
+ "dieser Anweisung ist undefiniert, wenn sich die Werte des Verzeichnisses",
+ "außerhalb dieses Bereichs befinden.",
+ "",
+ "",
+ "> NÄHERUNGS-LINEAR-TABELLE {yvar :=}",
+ " -{PWL[xvar] }-",
+ "",
+ "Dies ist eine gute Methode für die Näherungslösung einer komplizierten",
+ "Funktion oder Kurve. Sie könnte zum Beispiel hilfreich sein, wenn Sie",
+ "versuchen eine Eichkurve zu verwenden, um die rohe Ausgangsspannung",
+ "eines Fühlers in günstigere Einheiten zu wandeln.",
+ "",
+ "Angenommen Sie versuchen eine Näherungslösung für eine Funktion zu finden,",
+ "die eine Eingangs-Ganzzahlvariable ‘x’ in Ausgangs-Ganzzahlvariable ‘y’",
+ "wandelt. Einige Punkte der Funktion sind Ihnen bekannt; so würden Sie",
+ "z.B. die folgenden kennen:",
+ "",
+ " f(0) = 2",
+ " f(5) = 10",
+ " f(10) = 50",
+ " f(100) = 100",
+ "",
+ "Dies bedeutet, dass sich die Punkte",
+ "",
+ " (x0, y0) = ( 0, 2)",
+ " (x1, y1) = ( 5, 10)",
+ " (x2, y2) = ( 10, 50)",
+ " (x3, y3) = (100, 100)",
+ "",
+ "in dieser Kurve befinden. Diese 4 Punkte können Sie in die Tabelle der",
+ "‘Näherungs-Linear’-Anweisung eintragen. Die ‘Näherungs-Linear’-Anweisung",
+ "wird dann auf den Wert von ‘xvar’ schauen und legt den Wert von ‘yvar’",
+ "fest. Sie stellt ‘yvar’ so ein, dass die ‘Näherungs-Linear’-Kurve sich",
+ "durch alle Punkte bewegt, die Sie vorgegeben haben. Wenn Sie z.B. für",
+ "‘xvar’ = 10 vorgegeben haben, dann stellt die Anweisung ‘yvar’ auf gleich",
+ "50 ein.",
+ "",
+ "Falls Sie dieser Anweisung einen Wert ‘xvar’ zuweisen, der zwischen zwei",
+ "Werten von ‘x’ liegt, denen Sie Punkte zugeordnet haben, dann stellt die",
+ "Anweisung ‘yvar’ so ein, dass (‘xvar’, ‘yvar’) in der geraden Linie liegt;",
+ "diejenige die, die zwei Punkte in der Tabelle verbindet. Z.B. erzeugt",
+ "‘xvar’ = 55 bei ‘yvar’ = 75. Die beiden Punkte in der Tabelle sind (10,",
+ "50) und (100, 100). 55 liegt auf halbem Weg zwischen 10 und 100 und 75",
+ "liegt auf halbem Weg zwischen 50 und 100, somit liegt (55, 75) auf der",
+ "Linie, die diese zwei Punkte verbindet.",
+ "",
+ "Die Punkte müssen in aufsteigender Reihenfolge der x-Koordinaten",
+ "angegeben werden. Einige mathematische Operationen, erforderlich für",
+ "bestimmte Nachschlag-Tabellen mit 16-Bit-Mathematik, kann man ggf. nicht",
+ "ausführen. In diesem Falle gibt LDmicro eine Warnmeldung aus. So würde",
+ "z.B. die folgende Nachschlag-Tabelle eine Fehlermeldung hervorrufen:",
+ "",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (300, 300)",
+ "",
+ "Sie können diesen Fehler beheben, indem sie den Abstand zwischen den",
+ "Punkten kleiner machen. So ist zum Beispiel die nächste Tabelle äquivalent",
+ "zur vorhergehenden, ruft aber keine Fehlermeldung hervor.",
+ "",
+ " (x0, y0) = ( 0, 2)",
+ " (x1, y1) = (150, 150)",
+ " (x2, y2) = (300, 300)",
+ "",
+ "Es wird kaum einmal notwendig sein, mehr als fünf oder sechs Punkte",
+ "zu verwenden. Falls Sie mehr Punkte hinzufügen, so vergrößert dies",
+ "Ihren Code und verlangsamt die Ausführung. Falls Sie für ‘xvar’ einen",
+ "Wert vergeben, der größer ist, als die größte x-Koordinate der Tabelle",
+ "oder kleiner, als die kleinste x-Koordinate in der Tabelle, so ist das",
+ "Verhalten der Anweisung undefiniert. Diese Anweisung muss ganz rechts",
+ "im Netzwerk stehen.",
+ "",
+ "",
+ "> A/D-WANDLER EINLESEN AName",
+ " --{READ ADC}--",
+ "",
+ "LDmicro kann einen Code erzeugen, der ermöglicht, die A/D-Wandler",
+ "zu verwenden, die in manchen Mikroprozessoren vorgesehen sind.",
+ "Wenn der Eingangszustand dieser Anweisung ‘wahr’ ist, dann wird eine",
+ "Einzellesung von dem A/D-Wandler entnommen und in der Variablen ‘AName’",
+ "gespeichert. Diese Variable kann anschließend mit einer gewöhnlichen",
+ "Ganzzahlvariablen bearbeitet werden (wie: Kleiner als, größer als,",
+ "arithmetisch usw.). Weisen Sie ‘Axxx’ in der gleichen Weise einen Pin",
+ "zu, wie Sie einen Pin für einen digitalen Ein- oder Ausgang vergeben",
+ "würden, indem auf diesen in der Liste unten in der Maske (Bildanzeige)",
+ "doppelklicken. Wenn der Eingangszustand dieses Netzwerks ‘unwahr’ ist,",
+ "so wird die Variable ‘AName’ unverändert belassen.",
+ "",
+ "Für alle derzeitig unterstützten Prozessoren gilt: Eine 0 Volt Lesung",
+ "am Eingang des A/D-Wandlers entspricht 0. Eine Lesung gleich der",
+ "Versorgungsspannung (bzw. Referenzspannung) entspricht 1023. Falls Sie",
+ "AVR-Prozessoren verwenden, so verbinden Sie AREF mit Vdd. (Siehe Atmel",
+ "Datenblatt, dort wird eine Induktivität von 100µH empfohlen). Sie können",
+ "arithmetische Operationen verwenden, um einen günstigeren Maßstabfaktor",
+ "festzulegen, aber beachten Sie, dass das Programm nur Ganzzahl-Arithmetik",
+ "vorsieht. Allgemein sind nicht alle Pins als A/D-Wandler verwendbar. Die",
+ "Software gestattet Ihnen nicht, einen Pin zuzuweisen, der kein A/D",
+ "bzw. analoger Eingang ist. Diese Anweisung muss ganz rechts im Netzwerk",
+ "stehen.",
+ "",
+ "",
+ "> PULSWEITEN MODULATIONSZYKLUS FESTLEGEN duty_cycle",
+ " -{PWM 32.8 kHz}-",
+ "",
+ "LDmicro kann einen Code erzeugen, der ermöglicht, die PWM-Peripherie",
+ "zu verwenden, die in manchen Mikroprozessoren vorgesehen ist. Wenn die",
+ "Eingangsbedingung dieser Anweisung ‘wahr’ ist, so wird der Zyklus der",
+ "PWM-Peripherie mit dem Wert der Variablen ‘duty cycle’ gleichgesetzt. Der",
+ "‘duty cycle’ muss eine Zahl zwischen 0 und 100 sein. 0 entspricht immer",
+ "‘low’ und 100 entsprechend immer ‘high’. (Wenn Sie damit vertraut sind,",
+ "wie die PWM-Peripherie funktioniert, so bemerken Sie, dass dies bedeutet,",
+ "dass LDmicro die ‘duty cycle’-Variable automatisch prozentual zu den",
+ "PWM-Taktintervallen skaliert [= den Maßstabfaktor festlegt].)",
+ "",
+ "Sie können die PWM-Zielfrequenz in Hz definieren. Es kann vorkommen, dass",
+ "die angegebene Frequenz nicht genau erreicht wird, das hängt davon ab,",
+ "wie sich diese innerhalb der Taktfrequenz des Prozessors einteilt. LDmicro",
+ "wählt dann die nächst erreichbare Frequenz; falls der Fehler zu groß ist,",
+ "so wird eine Warnung ausgegeben. Höhere Geschwindigkeiten können die",
+ "Auflösung beeinträchtigen.",
+ "",
+ "Diese Anweisung muss ganz rechts im Netzwerk stehen. Die ‘ladder",
+ "logic’-Laufzeit verbraucht (schon) einen Timer, um die Zykluszeit",
+ "zu messen. Dies bedeutet, dass die PWM nur bei den Mikroprozessoren",
+ "verfügbar ist, bei denen mindestens zwei geeignete Timer vorhanden sind.",
+ "PWM verwendet den PIN CCP2 (nicht CCP1) bei den PIC16-Prozessoren und",
+ "OC2 (nicht OC1A) bei den AVR-Prozessoren.",
+ "",
+ "",
+ "> REMANENT MACHEN saved_var",
+ " --{PERSIST}--",
+ "",
+ "Wenn der Eingangszustand dieser Anweisung ‘wahr’ ist, so bewirkt",
+ "dies, dass eine angegebene Ganzzahl-Variable automatisch im EEPROM",
+ "gespeichert wird. Dies bedeutet, dass ihr Wert bestehen bleiben wird,",
+ "auch wenn der Prozessor seine Versorgungsspannung verliert. Es ist",
+ "nicht notwendig, die Variable an klarer Stelle im EEPROM zu speichern,",
+ "dies geschieht automatisch, so oft sich der Wert der Variablen",
+ "ändert. Bei Spannungswiederkehr wird die Variable automatisch vom",
+ "EEPROM zurückgespeichert. Falls eine Variable, die häufig ihren Wert",
+ "ändert, remanent (dauerhaft) gemacht wird, so könnte Ihr Prozessor sehr",
+ "rasch verschleißen, weil dieser lediglich für eine begrenzte Anzahl von",
+ "Schreibbefehlen konstruiert ist (~100 000). Wenn der Eingangszustand des",
+ "Netzwerks ‘unwahr’ ist, so geschieht nichts. Diese Anweisung muss ganz",
+ "rechts im Netzwerk stehen.",
+ "",
+ "",
+ "> UART (SERIELL) EMPFANGEN var",
+ " --{UART RECV}--",
+ "",
+ "LDmicro kann einen Code erzeugen, der ermöglicht UART zu verwenden,",
+ "welcher in manchen Mikroprozessoren vorgesehen ist.",
+ "Bei AVR-Prozessoren mir mehrfachem UART, wird nur UART1 (nicht UART0)",
+ "unterstützt. Konfigurieren Sie die Baudrate, indem Sie ‘Voreinstellungen",
+ "-> Prozessor-Parameter’ verwenden. Bestimmte Baudraten werden mit",
+ "bestimmten Quarzfrequenzen nicht erreichbar sein. In diesem Fall gibt",
+ "LDmicro eine Warnmeldung.",
+ "",
+ "Wenn der Eingangszustand dieser Anweisung ‘unwahr’ ist, so geschieht",
+ "nichts. Wenn der Eingangszustand ‘wahr’ ist, so versucht diese Anweisung",
+ "ein einzelnes Schriftzeichen vom UART-Eingang zu empfangen. Wenn",
+ "kein Schriftzeichen eingelesen wird, dann ist der Ausgangszustand",
+ "‘unwahr’. Wenn ein ASCII-Zeichen eingelesen wird, so wird sein Wert in",
+ "‘var’ abgespeichert und der Ausgangszustand wird für einen einzelnen",
+ "Zyklus ‘wahr’.",
+ "",
+ "",
+ "> UART (SERIELL) SENDEN var",
+ " --{UART SEND}--",
+ "",
+ "LDmicro kann einen Code erzeugen, der ermöglicht UART zu verwenden,",
+ "welcher in manchen Mikroprozessoren vorgesehen ist.",
+ "Bei AVR-Prozessoren mir mehrfachem UART, wird nur UART1 (nicht UART0)",
+ "unterstützt. Konfigurieren Sie die Baudrate, indem Sie ‘Voreinstellungen",
+ "-> Prozessor-Parameter’ verwenden. Bestimmte Baudraten werden mit",
+ "bestimmten Quarzfrequenzen nicht erreichbar sein. In diesem Fall gibt",
+ "LDmicro eine Warnmeldung.",
+ "",
+ "Wenn der Eingangszustand dieser Anweisung ‘unwahr’ ist, so geschieht",
+ "nichts. Wenn der Eingangszustand ‘wahr’ ist, so schreibt diese",
+ "Anweisung ein einzelnes Schriftzeichen zum UART. Der ASCII-Wert des",
+ "Schriftzeichens, welches gesendet werden soll, muss vorher in ‘var’",
+ "abgespeichert worden sein. Der Ausgangszustand dieses Netzwerks ist",
+ "‘wahr’, wenn UART beschäftigt ist (gerade dabei ein Schriftzeichen zu",
+ "übermitteln) und andernfalls ‘unwahr’.",
+ "",
+ "Denken Sie daran, dass einige Zeit zum Senden von Schriftzeichen",
+ "beansprucht wird. Überprüfen Sie den Ausgangszustand dieser Anweisung,",
+ "sodass das erste Schriftzeichen bereits übermittelt wurde, bevor Sie",
+ "versuchen ein zweites Schriftzeichen zu übermitteln. Oder verwenden Sie",
+ "einen Timer, um eine Verzögerung zwischen die Schriftzeichen fügen. Sie",
+ "dürfen den Eingangszustand dieser Anweisung nur dann auf ‘wahr’ setzen",
+ "(bzw. ein Schriftzeichen übermitteln), wenn der Ausgangszustand ‘unwahr’",
+ "ist (bzw. UART unbeschäftigt ist).",
+ "",
+ "Untersuchen Sie die “Formatierte Zeichenfolge”-Anweisung, bevor Sie",
+ "diese Anweisung verwenden. Die “Formatierte Zeichenfolge”- Anweisung",
+ "ist viel einfacher in der Anwendung und fast sicher fähig, das zu tun,",
+ "was Sie beabsichtigen.",
+ "",
+ " ",
+ "> FORMATIERTE ZEICHENFOLGE ÜBER UART var",
+ " -{\"Druck: \\3\\r\\n\"}-",
+ "",
+ "LDmicro kann einen Code erzeugen, der ermöglicht UART zu verwenden,",
+ "welcher in manchen Mikroprozessoren vorgesehen ist.",
+ "Bei AVR-Prozessoren mir mehrfachem UART, wird nur UART1 (nicht UART0)",
+ "unterstützt. Konfigurieren Sie die Baudrate, indem Sie ‘Voreinstellungen",
+ "-> Prozessor-Parameter’ verwenden. Bestimmte Baudraten werden mit",
+ "bestimmten Quarzfrequenzen nicht erreichbar sein. In diesem Fall gibt",
+ "LDmicro eine Warnmeldung.",
+ "",
+ "Wenn der Eingangszustand des Netzwerks für diese Anweisung von ‘unwahr’",
+ "auf ‘wahr’ übergeht, so beginnt diese eine vollständige Zeichenfolge",
+ "über den seriellen Anschluss zu senden. Wenn die Zeichenfolge die",
+ "besondere Reihenfolge ‘\\3’ enthält, dann wird diese Folge durch den Wert",
+ "von ‘var’ ersetzt, welcher automatisch in eine Zeichenfolge gewandelt",
+ "wird. Die Variable wird formatiert, sodass diese exakt 3 Schriftzeichen",
+ "übernimmt. Falls die Variable zum Beispiel gleich 35 ist, dann wird die",
+ "exakte ausgegebene Zeichenfolge, wie folgt aussehen: ‘Druck: 35\\r\\n’",
+ "(beachten Sie das zusätzliche Freizeichen). Wenn stattdessen die Variable",
+ "gleich 1432 ist, so wäre das Verhalten der Anweisung undefiniert,",
+ "weil 1432 mehr als drei Stellen hat. In diesem Fall wäre es notwendig",
+ "stattdessen ‘\\4’ zu verwenden.",
+ "",
+ "Falls die Variable negativ ist, so verwenden Sie stattdessen ‘\\-3d’",
+ "(oder ‘\\-4d’). LDmicro wird hierdurch veranlasst eine vorgestellte",
+ "Freistelle für positive Zahlen und ein vorgestelltes Minuszeichen für",
+ "negative Zahlen auszugeben.",
+ "",
+ "Falls mehrere “Formatierte Zeichenfolge”-Anweisungen zugleich ausgegeben",
+ "werden (oder wenn eine neue Zeichenfolge ausgegeben wird bevor die",
+ "vorherige vollendet ist), oder auch wenn diese mit UART TX Anweisungen",
+ "vermischt, so ist das Verhalten undefiniert.",
+ "",
+ "Es ist auch möglich diese Anweisung für eine feste Zeichenfolge zu",
+ "verwenden, die über den seriellen Anschluss gesendet wird, ohne den Wert",
+ "einer Ganzzahlvariablen in den Text zu interpolieren. In diesem Fall",
+ "fügen Sie einfach diese spezielle Steuerungsfolge nicht ein.",
+ "",
+ "Verwenden Sie ‘\\\\’ für einen zeichengetreuen verkehrten Schrägstrich.",
+ "Zusätzlich zur Steuerungsfolge für die Interpolierung einer Ganzzahl-",
+ "Variablen, sind die folgenden Steuerungszeichen erhältlich:",
+ "",
+ " * \\r -- carriage return Zeilenschaltung",
+ " * \\n -- new line Zeilenwechsel",
+ " * \\f -- form feed Formularvorschub",
+ " * \\b -- backspace Rücksetzen",
+ " * \\xAB -- character with ASCII value 0xAB (hex)",
+ " -- Schriftzeichen mit ASCII-Wert 0xAB (hex)",
+ "",
+ "Der Ausgangszustand des Netzwerks dieser Anweisung ist ‘wahr’, während",
+ "diese Daten überträgt, ansonsten ‘unwahr’. Diese Anweisung benötigt eine",
+ "große Menge des Programmspeichers, insofern sollte sie sparsam verwendet",
+ "werden. Die gegenwärtige Umsetzung ist nicht besonders effizient, aber",
+ "eine bessere würde Änderungen an sämtlichen Ausläufern des Programms",
+ "benötigen.",
+ "",
+ "",
+ "EIN HINWEIS ZUR VERWENDUNG DER MATHEMATIK",
+ "=========================================",
+ "",
+ "Denken Sie daran, dass LDmicro nur 16-Bit mathematische Operationen",
+ "ausführt. Dies bedeutet, dass das Endresultat jeder Berechnung,",
+ "die Sie vornehmen, eine Ganzzahl zwischen -32768 und 32767 sein muss.",
+ "Dies bedeutet auch, dass die Zwischenergebnisse Ihrer Berechnungen alle",
+ "in diesem Bereich liegen müssen.",
+ "",
+ "Wollen wir zum Beispiel annehmen, dass Sie folgendes berechnen möchten",
+ "y = (1/x) * 1200, in der x zwischen 1 und 20 liegt.",
+ "Dann liegt y zwischen 1200 und 60, was in eine 16-Bit Ganzzahl passt,",
+ "so wäre es zumindest theoretisch möglich diese Berechnung auszuführen.",
+ "Es gibt zwei Möglichkeiten, wie Sie dies codieren könnten: Sie können",
+ "die Reziproke (Kehrwert) ausführen and dann multiplizieren:",
+ "",
+ " || {DIV temp :=} ||",
+ " ||---------{ 1 / x }----------||",
+ " || ||",
+ " || {MUL y := } ||",
+ " ||----------{ temp * 1200}----------||",
+ " || ||",
+ "",
+ "Oder Sie könnten einfach die Division in einem Schritt direkt vornehmen.",
+ "",
+ " || {DIV y :=} ||",
+ " ||-----------{ 1200 / x }-----------||",
+ "",
+ "",
+ "Mathematisch sind die zwei äquivalent; aber wenn Sie diese ausprobieren,",
+ "so werden Sie herausfinden, dass die erste ein falsches Ergebnis von",
+ "y = 0 liefert. Dies geschieht, weil die Variable einen Unterlauf",
+ "[= resultatabhängige Kommaverschiebung] ergibt. So sei zum Beispiel x = 3,",
+ "(1 / x) = 0.333, dies ist aber keine Ganzzahl; die Divisionsoperation",
+ "nähert dies, als 'temp = 0'. Dann ist y = temp * 1200 = 0. Im zweiten",
+ "Fall gibt es kein Zwischenergebnis, welches einen Unterlauf [= resultats-",
+ "abhängige Kommaverschiebung] ergibt, somit funktioniert dann alles.",
+ "",
+ "Falls Sie Probleme bei Ihren mathematischen Operationen erkennen,",
+ "dann überprüfen Sie die Zwischenergebnisse auf Unterlauf [eine",
+ "resultatabhängige Kommaverschiebung] (oder auch auf Überlauf, der dann",
+ "im Programm in Umlauf kommt; wie zum Beispiel 32767 + 1 = -32768).",
+ "Wann immer möglich, wählen Sie Einheiten, deren Werte in einem Bereich",
+ "von -100 bis 100 liegen.",
+ "",
+ "Falls Sie eine Variable um einen bestimmten Faktor vergrößern müssen, tun",
+ "Sie dies, indem Sie eine Multiplikation und eine Division verwenden. Um",
+ "zum Beispiel y = 1.8 * x zu vergrößern, berechnen Sie y = (9/5) * x,",
+ "(was dasselbe ist, weil 1,8 = 9/5 ist), und codieren Sie dies als",
+ "y = (9 * x)/5, indem Sie die Multiplikation zuerst ausführen.",
+ "",
+ " || {MUL temp :=} ||",
+ " ||---------{ x * 9 }----------||",
+ " || ||",
+ " || {DIV y :=} ||",
+ " ||-----------{ temp / 5 }-----------||",
+ "",
+ "",
+ "Dies funktioniert mit allen x < (32767 / 9), oder x < 3640. Bei höheren",
+ "Werten würde die Variable ‘temp’ überfließen. Für x gibt es eine",
+ "ähnliche Untergrenze.",
+ "",
+ "",
+ "KODIER-STIL",
+ "===========",
+ "",
+ "Ich gestatte mehrere Spulen in Parallelschaltung in einem einzigen",
+ "Netzwerk unterzubringen. Das bedeutet, sie können ein Netzwerk, wie",
+ "folgt schreiben:",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || Xb Yb ||",
+ " ||-------] [------+-------( )-------||",
+ " || | ||",
+ " || | Yc ||",
+ " || +-------( )-------||",
+ " || ||",
+ " ",
+ "Anstatt diesem:",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yb ||",
+ " 2 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yc ||",
+ " 3 ||-------] [--------------( )-------||",
+ " || ||",
+ "",
+ "Rein theoretisch bedeutet das, dass Sie irgendein Programm, als ein",
+ "gigantisches Netzwerk, schreiben könnten. Und es bestünde überhaupt",
+ "keine Notwendigkeit mehrere Netzwerke zu verwenden. In der Praxis ist",
+ "dies aber eine schlechte Idee, denn wenn Netzwerke komplexer werden, so",
+ "werden sie auch schwieriger zu editieren, ohne Löschen und neu Schreiben",
+ "von Anweisungen.",
+ "",
+ "Jedoch, ist es manchmal ein guter Einfall, verwandte Logik in einem",
+ "einzelnen Netzwerk zusammenzufassen. Dies erzeugt einen beinahe",
+ "identischen Code, als ob sie getrennte Netzwerke entworfen hätten, es",
+ "zeigt aber, dass diese Anweisungen (Logik) verwandt ist, wenn man diese",
+ "im Netzwerk-Diagramm betrachtet.",
+ "",
+ " * * *",
+ "",
+ "Im Allgemeinen hält man es für eine schlechte Form, den Code in einer",
+ "solchen Weise zu schreiben, dass sein Ergebnis von einer Folge von",
+ "Netzwerken abhängt. So zum Beispiel ist der folgende Code nicht besonders",
+ "gut, falls ‘xa’ und ‘xb’ jemals ‘wahr’ würden.",
+ "",
+ " || Xa {v := } ||",
+ " 1 ||-------] [--------{ 12 MOV}--||",
+ " || ||",
+ " || Xb {v := } ||",
+ " ||-------] [--------{ 23 MOV}--||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || [v >] Yc ||",
+ " 2 ||------[ 15]-------------( )-------||",
+ " || ||",
+ "",
+ "Ich werde diese Regel brechen und indem ich dies so mache, entwerfe ich",
+ "einen Code-Abschnitt, der erheblich kompakter ist. Hier zum Beispiel,",
+ "zeige ich auf, wie ich eine 4-Bit binäre Größe von ‘xb3:0’ in eine",
+ "Ganzzahl wandeln würde.",
+ "",
+ " || {v := } ||",
+ " 3 ||-----------------------------------{ 0 MOV}--||",
+ " || ||",
+ " || Xb0 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 1 }-----------||",
+ " || ||",
+ " || Xb1 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 2 }-----------||",
+ " || ||",
+ " || Xb2 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 4 }-----------||",
+ " || ||",
+ " || Xb3 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 8 }-----------||",
+ " || ||",
+ "",
+ "Falls die TRANSFER-Anweisung (MOV) an das untere Ende des Netzwerks",
+ "gebracht würde, anstatt auf das obere, so würde der Wert von ‘v’, an",
+ "anderer Stelle im Programm gelesen, gleich Null sein. Das Ergebnis dieses",
+ "Codes hängt daher von der Reihenfolge ab, in welcher die Anweisungen",
+ "ausgewertet werden. Im Hinblick darauf, wie hinderlich es wäre, diesen",
+ "Code auf eine andere Weise zu schreiben, nehme ich dies so hin.",
+ "",
+ "",
+ "BUGS",
+ "====",
+ "",
+ "LDmicro erzeugt keinen sehr effizienten Code; es ist langsam in der",
+ "Ausführung und geht verschwenderisch mit dem Flash- und RAM-Speicher",
+ "um. Trotzdem kann ein mittelgroßer PIC- oder AVR-Prozessor alles, was",
+ "eine kleine SPS kann, somit stört dies mich nicht besonders.",
+ "",
+ "Die maximale Länge der Variabelen-Bezeichnungen (-Namen) ist sehr",
+ "begrenzt. Dies ist so, weil diese so gut in das KOP-Programm (ladder)",
+ "passen. Somit sehe ich keine gute Lösung für diese Angelegenheit.",
+ "",
+ "Falls Ihr Programm zu groß für die Zeit-, Programmspeicher- oder",
+ "Datenspeicher-Beschränkungen des Prozessors ist, den Sie gewählt haben,",
+ "so erhalten Sie keine Fehlermeldung. Es wird einfach irgendwo anders alles",
+ "vermasseln. (Anmerkung: Das AVR STK500 gibt hierzu Fehlermeldungen aus.)",
+ "",
+ "Unsorgfältiges Programmieren bei den Datei Öffnen/Abspeichern-Routinen",
+ "führen wahrscheinlich zu der Möglichkeit eines Absturzes oder es wird",
+ "ein willkürlicher Code erzeugt, der eine beschädigte oder bösartige .ld",
+ "Datei ergibt.",
+ "",
+ "Bitte berichten Sie zusätzliche Bugs oder richten Sie Anfragen für neue",
+ "Programm-Bestandteile an den Autor (in Englisch).",
+ "",
+ "Thanks to:",
+ " * Marcelo Solano, for reporting a UI bug under Win98",
+ " * Serge V. Polubarjev, for not only noticing that RA3:0 on the",
+ " PIC16F628 didn't work but also telling me how to fix it",
+ " * Maxim Ibragimov, for reporting and diagnosing major problems",
+ " with the till-then-untested ATmega16 and ATmega162 targets",
+ " * Bill Kishonti, for reporting that the simulator crashed when the",
+ " ladder logic program divided by zero",
+ " * Mohamed Tayae, for reporting that persistent variables were broken",
+ " on the PIC16F628",
+ " * David Rothwell, for reporting several user interface bugs and a",
+ " problem with the \"Export as Text\" function",
+ "",
+ "Particular thanks to Heinz Ullrich Noell, for this translation (of both",
+ "the manual and the program's user interface) into German.",
+ "",
+ "",
+ "COPYING, AND DISCLAIMER",
+ "=======================",
+ "",
+ "DO NOT USE CODE GENERATED BY LDMICRO IN APPLICATIONS WHERE SOFTWARE",
+ "FAILURE COULD RESULT IN DANGER TO HUMAN LIFE OR DAMAGE TO PROPERTY. THE",
+ "AUTHOR ASSUMES NO LIABILITY FOR ANY DAMAGES RESULTING FROM THE OPERATION",
+ "OF LDMICRO OR CODE GENERATED BY LDMICRO.",
+ "",
+ "This program is free software: you can redistribute it and/or modify it",
+ "under the terms of the GNU General Public License as published by the",
+ "Free Software Foundation, either version 3 of the License, or (at your",
+ "option) any later version.",
+ "",
+ "This program is distributed in the hope that it will be useful, but",
+ "WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY",
+ "or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License",
+ "for more details.",
+ "",
+ "You should have received a copy of the GNU General Public License along",
+ "with this program. If not, see <http://www.gnu.org/licenses/>.",
+ "",
+ "",
+ "Jonathan Westhues",
+ "",
+ "Rijswijk -- Dec 2004",
+ "Waterloo ON -- Jun, Jul 2005",
+ "Cambridge MA -- Sep, Dec 2005",
+ " Feb, Mar 2006",
+ "",
+ "Email: user jwesthues, at host cq.cx",
+ "",
+ "",
+ NULL
+};
+#endif
+
+#ifdef LDLANG_FR
+char *HelpTextFr[] = {
+ "INTRODUCTION",
+ "============",
+ "",
+ "LDmicro génére du code natif pour certains microcontroleurs Microchip",
+ "PIC16F et Atmel AVR. Usuellement les programmes de developpement pour ces",
+ "microcontrolleurs sont écrits dans des langages comme l'assembleur , le",
+ "C ou le Basic. Un programme qui utilise un de ces langages est une suite",
+ "de commandes. Ces programmes sont puissants et adaptés à l'architecture",
+ "des processeurs, qui de façon interne exécutent une liste d'instructions.",
+ "",
+ "Les API (Automates Programmables Industriels, PLC en anglais, SPS en",
+ "allemand) utilisent une autre voie et sont programmés en Langage à",
+ "Contacts (ou LADDER). Un programme simple est représenté comme ceci :",
+ "",
+ "",
+ " || ||",
+ " || Xbutton1 Tdon Rchatter Yred ||",
+ " 1 ||-------]/[---------[TON 1.000 s]-+-------]/[--------------( )-------||",
+ " || | ||",
+ " || Xbutton2 Tdof | ||",
+ " ||-------]/[---------[TOF 2.000 s]-+ ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Rchatter Ton Tnew Rchatter ||",
+ " 2 ||-------]/[---------[TON 1.000 s]----[TOF 1.000 s]---------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " ||------[END]---------------------------------------------------------||",
+ " || ||",
+ " || ||",
+ "",
+ "(TON est une tempo travail; TOF est une tempo repos. les commandes --] [-- ",
+ "représentent des Entrées, qui peuvent être des contacts de relais. Les ",
+ "commandes --( )-- sont des Sorties, qui peuvent représenter des bobines de ",
+ "relais. Beaucoup de références de programmes de langage à contacts (LADDER) ",
+ "existent sur Internet et sont à quelques détails près, identiques à ",
+ "l'implémentation représentée ci-dessus.",
+ "",
+ "Un certain nombre de différences apparaissent entre les programmes en",
+ "langage évolués ( C, Basic, Etc..) et les programmes pour API:",
+ "",
+ " * Le programme est représenté dans un format graphique, et non",
+ " comme une liste de commandes en format texte. Beaucoup de personnes",
+ " trouve cela plus facile à comprendre.",
+ "",
+ " * Au niveau de base, le programme apparait comme un diagramme",
+ " de circuit avec des contacts de relais (Entrées) et des bobines",
+ " (Sorties). Ceci est intuitif pour les programmeurs qui connaissent",
+ " la théorie des circuits électriques.",
+ "",
+ " * Le compilateur de langage à contacts vérifie tout ceci lors",
+ " de la compilation. Vous n'avez pas à écrire de code quand une",
+ " Sortie est remplacée et est remise en Entrée ou si une temporisation",
+ " est modifiée, vous n'avez pas non plus à spécifier l'ordre où les",
+ " calculs doivent être effectués. L'outil API (PLC) s'occupe de cela",
+ " pour vous.",
+ "",
+ "",
+ "LDmicro compile le langage à contact (ladder) en code pour PIC16F ou",
+ "AVR. Les processeurs suivants sont supportés:",
+ "",
+ " * PIC16F877",
+ " * PIC16F628",
+ " * PIC16F876 (non testé)",
+ " * PIC16F88 (non testé)",
+ " * PIC16F819 (non testé)",
+ " * PIC16F887 (non testé)",
+ " * PIC16F886 (non testé)",
+ " * ATmega128",
+ " * ATmega64",
+ " * ATmega162 (non testé)",
+ " * ATmega32 (non testé)",
+ " * ATmega16 (non testé)",
+ " * ATmega8 (non testé)",
+ "",
+ "Il doit être facile de supporter d'autres PIC ou AVR, mais je n'est",
+ "aucun moyen pour les tester. Si vous en voulez un en particulier faites",
+ "moi parvenir votre demande et je verrai ce que je peux faire.",
+ "",
+ "En utilisant LDmicro, vous dessinez un diagramme à contacts pour votre",
+ "programme. Vous pouvez simuler le fonctionnement logique en temps réel sur",
+ "votre PC. Quand vous êtes convaincu que le fonctionnement est correct,",
+ "vous pouvez affecter les broches du microcontroleur pour les Entrées et",
+ "Sorties, ensuite vous compilez votre programmeen code AVR ou PIC. Le",
+ "fichier de sortie du compilateur est un fichier .HEX que vous devrez",
+ "mettre dans le microcontroleur en utilisant un programmateur pour PIC",
+ "ou AVR.",
+ "",
+ "",
+ "LDmicro est conçu pour être similaire à la majorité des API commerciaux.",
+ "Il y a quelques exceptions, et une partie des possibilités n'est",
+ "pas standard avec le matériel industriel. Lire attentivement la",
+ "description de chaque instruction même si elle parait familière. Ce",
+ "document considère que vous avez une connaisance de base du langage à",
+ "contact et de la structure des logiciels pour automates programmables.",
+ "Cycle d'exécution : Lecture des Entrées -> Calculs -> Ecriture des Sorties",
+ "",
+ "",
+ "CIBLES ADDITIONNELLES ",
+ "=====================",
+ "",
+ "Il est aussi possible de générer du code ANSI C . Vous pouvez utiliser",
+ "ceci pour n'importe quel processeur dont vous avez un compilateur C,",
+ "mais le runtime est de votre responsabilité. LDmicro gérére uniquement",
+ "le source pour le cycle de l'API. Vous êtes responsable de l'appel de",
+ "chaque séquence du cycle et de l'implémentation de toutes les Entrées",
+ "/ Sorties (Lecture/Ecriture des Entrées digitales, etc ...). Voir les",
+ "commentaires dans le code source pour plus de détails.",
+ "",
+ "Finalement, LDmicro peut générer un code byte indépendant du processeur",
+ "pour une machine virtuelle prévue pour faire fonctionner ce type de code.",
+ "J'ai prévu un exemple simple d'implémentation d'un interpréteur /VM",
+ "écrit en code C le plus portable possible. La cible fonctionne juste sur",
+ "quelques plateformes ou vous pouvez prévoir votre VM. Ceci peut être utile",
+ "pour des applications ou vous pouvez utiliser le languages à contacts",
+ "comme du langage script pour customiser un programme important. Voir",
+ "les commentaires dans l'exemple pour les détails.",
+ "",
+ "",
+ "OPTIONS LIGNE DE COMMANDE",
+ "=========================",
+ "",
+ "LDmicro.exe fonctionne normallement sans options de ligne de commande.",
+ "Vous pouvez faire un raccourci vers le programme et le sauvegarder sur",
+ "l'écran , il suffit alors de faire un double clic pour le faire démarrer",
+ "et vous vous retrouvez ainsi dans l'interface utilisateur.",
+ "",
+ "Si un nom de fichier est passé en ligne de de commande de LDmicro, (ex:",
+ "`ldmicro.exe asd.ld'), alors LDmicro va essayer d'ouvrir `asd.ld', si",
+ "il existe. Une erreur se produira si `asd.ld' n'existe pas. Vous avez",
+ "la possibilité d'associer LDmicro avec les fichiers d'extention .ld.",
+ "Ceci permet à LDmicro de démarrer automatiquement lors d'un double clic",
+ "sur un fichier xxx.ld.",
+ "",
+ "Si les arguments de la ligne de commande sont passés sous la forme:",
+ "`ldmicro.exe /c src.ld dest.hex', LDmicro compilera le programme`src.ld',",
+ "et sauvegardera le fichier compilé sous`dest.hex'. Après compilation",
+ "LDmicro se termine, que la compilation soit correcte ou pas. Aucun",
+ "message n'est affiché sur la console. Ce mode est pratique uniquement",
+ "lorsque vous exécutez LDmicro en ligne de commande.",
+ "",
+ "",
+ "BASES",
+ "=====",
+ "",
+ "Si vous exécutez LDmicro sans arguments de ligne de commande, il démarre",
+ "avec un programme vide. Si vous démarrer avec le nom d'un programme",
+ "langage à contacts (xxx.ld) en ligne de commande, il va essayer de",
+ "charger le programme au démarrage. LDmicro utilise son format interne",
+ "pour le programme , il ne peut pas importer de programmes édités par",
+ "d'autres outils.",
+ "",
+ "Si vous ne chargez pas un programme existant, LDmicro démarre en insérant",
+ "une ligne vide. Vous pouvez ajouter les instructions pour votre programme:",
+ "par exemple ajouter un jeu de contacts (Instruction -> Insérer Contact)",
+ "qui sera nommé `Xnew'. `X' désigne un contact qui peut être lié à une",
+ "broche d'entrée du microcontroleur, vous pouvez affecter la broche pour",
+ "ce contact plus tard après avoir choisi le microcontroleur et renommé",
+ "les contacts. La première lettre indique de quel type de composants il",
+ "s'agit par exemple :",
+ "",
+ " * Xnom -- Relié à une broche d'entrée du microcontroleur",
+ " * Ynom -- Relié à une broche de sortie du microcontroleur",
+ " * Rnom -- `Relais interne': un bit en mémoire",
+ " * Tnom -- Temporisation; Tempo travail, tempo repos, ou totalisatrice",
+ " * Cnom -- Compteur, Compteur ou décompteur",
+ " * Anom -- Un entier lu sur un comvertisseur A/D ",
+ " * nom -- Variable générique (Entier : Integer)",
+ "",
+ "Choisir le reste du nom pour décrire l'utilisation de ce que fait cet",
+ "objet et qui doit être unique dans tout le programme. Un même nom doit",
+ "toujours se référer au même objet dans le programme en entier.Par",
+ "exemple , vous aurez une erreur si vous utilisez une tempo travail",
+ "(TON) appellée TDelai et une tempo repos (TOF) appellée aussi TDelai",
+ "dans le même programme, le comptage effectué par ces tempo utilisera le",
+ "même emplacement en mémoire, mais il est acceptable d'avoir une tempo",
+ "sauvegardée (RTO) Tdelai même nom avec une instruction de RES, dans ce",
+ "cas l'instruction fonctionne avec le même timer.",
+ "",
+ "Les noms de variables peuvent être des lettres, chiffres ou le",
+ "caractère _. Un nom de variable ne doit pas commencer par un chiffre.",
+ "Les noms de variables sont sensibles à la casse (majuscule/minuscules).",
+ "",
+ "Les instructions de manipulation de variables (MOV, ADD, EQU,",
+ "etc.) peuvent travailler avec des variables de n'importe quel nom. Elles",
+ "peuvent avoir accès aux accumulateurs des temporisations ou des",
+ "compteurs. Cela peut quelquefois être très utile, par exemple si vous",
+ "voulez contrôler la valeur d'un compteur ou d'une temporisation dans",
+ "une ligne particulière.",
+ "",
+ "Les variables sont toujours des entiers 16 bits. Leur valeur peut",
+ "donc être comprise entre -32768 et 32767 inclus. Les variables sont",
+ "toujours signées. Vous pouvez les spécifier de façon littérale comme",
+ "des nombres décimaux normaux (0, 1234, -56), vous pouvez aussi les",
+ "spécifier en caractères ASCII ('A', 'z') en mettant le caractère entre",
+ "des guillemets simples. Vous pouvez utiliser un caractère ASCII dans la",
+ "majorité des endroits où vous pouvez utiliser les nombres décimaux.",
+ "",
+ "En bas de l'écran, vous pouvez voir la liste de tous les objets",
+ "utilisés dans votre programme. La liste est automatiquement générée",
+ "à partir du programme. La majorité des objets ne necessitent aucune",
+ "configuration. Seuls : les objets `Xnom', `Ynom', and `Anom' doivent être",
+ "affectés à une broche du micro La première chose à faire est de choisir",
+ "la microcontroleur utilisé : Paramères -> Microcontroleur ensuite vous",
+ "affectez les broches en faisant un double clic dans la liste.",
+ "",
+ "Vous pouvez modifier le programme en insérant ou supprimant des",
+ "instructions. Le curseur clignote dans la programme pour indiquer",
+ "l'instruction courante sélectionnée et le point d'insertion. S'il ne",
+ "clignote pas pressez <Tab> ou cliquer sur une instruction, ou vous",
+ "pouvez insérer une nouvelle instruction à la droite ou à la gauche",
+ "(en série avec), ou au dessous ou au dessus (en parallèle avec) de",
+ "l'instruction sélectionnée. Quelques opérations ne sont pas permises ,",
+ "par exemple aucune instruction permise à droite de la bobine.",
+ "",
+ "Le programme démarre avec uniquement une ligne. Vous pouvez ajouter",
+ "plusieurs lignes en sélectionnant Insertion -> Ligne avant ou après",
+ "dans le menu. Vous pouvez faire un circuit complexe en plaçant plusieurs",
+ "branches en parallèle ou en série avec une ligne, mais il est plus clair",
+ "de faire plusieurs lignes.",
+ "",
+ "Une fois votre programme écrit, vous pouvez le tester par simulation,",
+ "et le compiler dans un fichier HEX pour le microcontroleur de destination.",
+ "",
+ "SIMULATION",
+ "==========",
+ "",
+ "Pour entrer dans la mode simulation choisir Simulation -> Simuler",
+ "ou presser <Ctrl+M> le programme est affiché différemment en mode",
+ "simulation. Les instructions activées sont affichées en rouge vif, les",
+ "instructions qui ne le sont pas sont affichées en grisé. Appuyer sur la",
+ "barre d'espace pour démarrer l'API pour 1 cycle. Pour faire fonctionner",
+ "continuellement en temps réel choisir Simulation ->Démarrer la simulation",
+ "en temps réel ou presser <Ctrl+R> L'affichage du programme est mise à",
+ "jour en temps réel en fonction des changements d'état des entrées.",
+ "",
+ "Vous pouvez valider l'état des entrées du programme en faisant un",
+ "double clic sur l'entrée dans la liste au bas de l'écran, ou sur le",
+ "contact `Xnom' de l'instruction dans le programme, pour avoir le reflet",
+ "automatiquement de la validation d'une entrée dans le programme, il",
+ "faut que le programme soit en cycle.(le démarrer par <Ctrl+R> ou barre",
+ "d'espace pour un seul cycle).",
+ "",
+ "COMPILER EN CODE NATIF",
+ "======================",
+ "",
+ "Le point final est de générer un fichier .HEX qui sera programmé dans le",
+ "microcontroleur que vous avez choisi par Paramètres -> Microcontroleur",
+ "Vous devez affecter les broches d'entrées sorties pour chaque 'Xnom'",
+ "et 'Ynom'. Vous pouvez faire cela en faisant un double clic sur la nom",
+ "de l'objet dans la liste au bas de l'écran. Une boite de dialogue vous",
+ "demande de choisir une des broches non affectées dans la liste.",
+ "",
+ "Vous devez aussi choisir la temps de cycle que voulez utiliser pour",
+ "votre application, vous devez aussi choisir la fréquence d'horloge du",
+ "processeur. Faire Paramètres -> Paramètres MCU dans le menu. En général,",
+ "le temps de cycle peut être laissé à la valeur par défaut (10 ms) qui est",
+ "une bonne valeur pour la majorité des applications. Indiquer la fréquence",
+ "du quartz utilisé (ou du résonateur céramique ou autres..) et cliquer OK.",
+ "",
+ "Maintenant vous pouvez créer le fichier pour intégrer dans le",
+ "microcontroleur. Choisir Compilation -> Compiler, ou compiler sous...",
+ "Si vous avez précédemment compilé votre programme, vous pouvez spécifier",
+ "un nom différent de fichier de sortie. Si votre programme ne comporte",
+ "pas d'erreur (lié à la structure du programme), LDmicro génére un fichier",
+ "IHEX prêt à être programmé dans le chip.",
+ "",
+ "Utilisez votre logiciel et matériel de programmation habituel pour",
+ "charger le fichier HEX dans la microcontroleur. Vérifiez et validez",
+ "les bits de configuration (fuses), pour les processeurs PIC16Fxxx ces",
+ "bits sont inclus dans le fichier HEX, et la majorité des logiciels de",
+ "programmation les valident automatiquement, pour les processeurs AVR ,",
+ "vous devez le faire manuellement.",
+ "",
+ "REFERENCE DES INSTRUCTIONS ",
+ "==========================",
+ "",
+ "> CONTACT, NORMALLEMENT OUVERT Xnom Rnom Ynom",
+ " ----] [---- ----] [---- ----] [----",
+ "",
+ " Si le signal arrivant à cette instruction est FAUX (0) le signal",
+ " de sortie est aussi faux (0), s'il est vrai , il sera aussi vrai",
+ " en sortie si et uniquement si la broche d'Entrée ou de Sortie",
+ " ou de Relais interne est vraie, sinon l'instruction sera fausse.",
+ " Cette instruction peut vérifier l'état d'une broche d'entrée, d'une",
+ " broche de sortie ou d'un relais interne",
+ "",
+ " ",
+ "> CONTACT, NORMALLEMENT FERME Xnom Rnom Ynom",
+ " ----]/[---- ----]/[---- ----]/[----",
+ "",
+ " Si le signal arrivant à cette instruction est FAUX (0) le signal",
+ " de sortie est vrai (1), s'il est vrai , il sera faux en sortie .",
+ " Cette instruction peut vérifier l'état d'une broche d'entrée, d'une",
+ " broche de sortie ou d'un relais interne. Fonctionne en opposition",
+ " par rapport au contact normallement ouvert.",
+ "",
+ "",
+ "> BOBINE, NORMALE Rnom Ynom",
+ " ----( )---- ----( )----",
+ "",
+ " Si le signal arrivant à cette instruction est faux, alors le relais ",
+ " interne ou la broche de sortie est faux (mise à zéro). Si le signal",
+ " arrivant à cette instruction est vrai(1), alors le relais interne ou",
+ " la broche de sortie est validée (mise à 1). Il n'est pas important",
+ " d'affecter une variable à une bobine.",
+ " Cette instruction est placée le plus à droite dans une séquence.",
+ " ",
+ "",
+ "> BOBINE, INVERSE Rnom Ynom",
+ " ----(/)---- ----(/)----",
+ "",
+ " Si le signal arrivant à cette instruction est vrai, alors le relais ",
+ " interne ou la broche de sortie est faux (mise à zéro). Si le signal",
+ " arrivant à cette instruction est faux(0), alors le relais interne ou",
+ " la broche de sortie est validée (mise à 1). Il n'est pas important ",
+ " d'affecter une variable à une bobine.",
+ " Cette instruction est placée le plus à droite dans une séquence.",
+ "",
+ "",
+ "> BOBINE, ACCROCHAGE Rnom Ynom",
+ " ----(S)---- ----(S)----",
+ "",
+ " Si le signal arrivant à cette instruction est vrai, alors le",
+ " relais interne ou la broche de sortie est validée (mise à 1). Cette",
+ " instruction permet de changer l'état d'un relais ou d'une sortie :",
+ " uniquement passe à vrai, ou reste vrai si elle était déjà à 1,",
+ " elle est typiquement utilisée en combinaison avec une Bobine REMISE",
+ " A ZERO.",
+ " Cette instruction est placée le plus à droite dans une séquence.",
+ "",
+ "",
+ "> BOBINE, REMISE A ZERO Rnom Ynom",
+ " ----(R)---- ----(R)----",
+ "",
+ " Si le signal arrivant à cette instruction est vrai, alors le relais ",
+ " interne ou la sortie est mise à zéro (0), si elle était déjà à 0, ",
+ " il n'y a aucun changement, cette instruction change l'état d'une ",
+ " sortie uniquement si elle était à 1, cette instruction fonctionne en ",
+ " combinaison avec l'instruction ci-dessus Bobine à ACCROCHAGE.",
+ " Cette instruction est placée le plus à droite dans une séquence.",
+ "",
+ "",
+ "> TEMPORISATION TRAVAIL Tdon ",
+ " -[TON 1.000 s]-",
+ "",
+ " Quand la signal arrivant à cette instruction passe de faux à vrai",
+ " (0 à 1), le signal de sortie attend 1.000 seconde avant de passer",
+ " à 1. Quand le signal de commande de cette instruction passe ZERO,",
+ " le signal de sortie passe immédiatement à zéro. La tempo est remise",
+ " à zéro à chaque fois que l'entrée repasse à zéro. L'entrée doit être",
+ " maintenue vraie à 1 pendant au moins 1000 millisecondes consécutives",
+ " avant que la sortie ne devienne vraie. le délai est configurable.",
+ "",
+ " La variable `Tnom' compte depuis zéro en unités de temps de scan.",
+ " L'instruction Ton devient vraie en sortie quand la variable du",
+ " compteur est plus grande ou égale au delai fixé. Il est possible",
+ " de manipuler la variable du compteur en dehors, par exemple par une",
+ " instruction MOVE.",
+ "",
+ "",
+ "> TEMPORISATION REPOS Tdoff ",
+ " -[TOF 1.000 s]-",
+ "",
+ " Quand le signal qui arrive à l'instruction passe de l'état vrai",
+ " (1) à l'état faux (0), la sortie attend 1.000 s avant de dévenir",
+ " faux (0) Quand le signal arrivant à l'instruction passe de l'état",
+ " faux à l'état vrai, le signal passe à vrai immédiatement. La",
+ " temporisation est remise à zéro à chaque fois que l'entrée devient",
+ " fausse. L'entrée doit être maintenue à l'état faux pendant au moins",
+ " 1000 ms consécutives avant que la sortie ne passe à l'état faux. La",
+ " temporisation est configurable.",
+ "",
+ " La variable `Tname' compte depuis zéro en unités de temps de scan.",
+ " L'instruction Ton devient vraie en sortie quand la variable du",
+ " compteur est plus grande ou égale au delai fixé. Il est possible",
+ " de manipuler la variable du compteur en dehors, par exemple par une",
+ " instruction MOVE.",
+ "",
+ "",
+ "> TEMPORISATION TOTALISATRICE Trto ",
+ " -[RTO 1.000 s]-",
+ "",
+ " Cette instruction prend en compte le temps que l'entrée a été à l'état",
+ " vrai (1). Si l'entrée a été vraie pendant au moins 1.000s la sortie",
+ " devient vraie (1).L'entrée n'a pas besoin d'être vraie pendant 1000 ms",
+ " consécutives. Si l'entrée est vraie pendant 0.6 seconde puis fausse",
+ " pendant 2.0 secondes et ensuite vraie pendant 0.4 seconde, la sortie",
+ " va devenir vraie. Après être passé à l'état vrai, la sortie reste",
+ " vraie quelque soit la commande de l'instruction. La temporisation",
+ " doit être remise à zéro par une instruction de RES (reset).",
+ "",
+ " La variable `Tnom' compte depuis zéro en unités de temps de scan.",
+ " L'instruction Ton devient vraie en sortie quand la variable du",
+ " compteur est plus grande ou égale au delai fixé. Il est possible",
+ " de manipuler la variable du compteur en dehors, par exemple par une",
+ " instruction MOVE.",
+ "",
+ "",
+ "> RES Remise à Zéro Trto Citems",
+ " ----{RES}---- ----{RES}----",
+ "",
+ " Cette instruction fait un remise à zéro d'une temporisation ou d'un",
+ " compteur. Les tempos TON et TOF sont automatiquement remisent à zéro",
+ " lorsque leurs entrées deviennent respectivement fausses ou vraies,",
+ " RES n'est pas donc pas nécessaire pour ces tempos. Les tempos RTO",
+ " et les compteurs décompteurs CTU / CTD ne sont pas remis à zéro",
+ " automatiquement, il faut donc utiliser cette instruction. Lorsque",
+ " l'entrée est vraie , le compteur ou la temporisation est remis à",
+ " zéro. Si l'entrée reste à zéro, aucune action n'est prise.",
+ " Cette instruction est placée le plus à droite dans une séquence.",
+ "",
+ "",
+ "> FRONT MONTANT _",
+ " --[OSR_/ ]--",
+ "",
+ " La sortie de cette instruction est normallement fausse. Si",
+ " l'instruction d'entrée est vraie pendant ce scan et qu'elle était",
+ " fausse pendant le scan précédent alors la sortie devient vraie. Elle",
+ " génére une impulsion à chaque front montant du signal d'entrée. Cette",
+ " instruction est utile si vous voulez intercepter le front montant",
+ " du signal.",
+ "",
+ "",
+ "> FRONT DESCENDANT _",
+ " --[OSF \\_]--",
+ "",
+ " La sortie de cette instruction est normallement fausse. Si",
+ " l'instruction d'entrée est fausse (0) pendant ce scan et qu'elle",
+ " était vraie (1) pendant le scan précédent alors la sortie devient",
+ " vraie. Elle génére une impulsion à chaque front descendant du signal",
+ " d'entrée. Cette instruction est utile si vous voulez intercepter le",
+ " front descendant d'un signal.",
+ "",
+ "",
+ "> COURT CIRCUIT (SHUNT), CIRCUIT OUVERT",
+ " ----+----+---- ----+ +----",
+ "",
+ " Une instruction shunt donne en sortie une condition qui est toujours ",
+ " égale à la condition d'entrée. Une instruction Circuit Ouvert donne ",
+ " toujours une valeur fausse en sortie.",
+ " Ces instructions sont en général utilisées en phase de test.",
+ "",
+ "",
+ "> RELAIS DE CONTROLE MAITRE",
+ " -{MASTER RLY}-",
+ "",
+ " Par défaut, la condition d'entrée d'une ligne est toujours vraie. Si",
+ " une instruction Relais de contrôle maitre est exécutée avec une",
+ " valeur d'entrée fausse, alors toutes les lignes suivantes deviendront",
+ " fausses. Ceci va continuer jusqu'à la rencontre de la prochaine",
+ " instruction relais de contrôle maitre qui annule l'instruction de",
+ " départ. Ces instructions doivent toujours être utilisées par paires:",
+ " une pour commencer (qui peut être sous condition) qui commence la",
+ " partie déactivée et une pour la terminer.",
+ "",
+ "",
+ "> MOUVOIR {destvar := } {Tret := }",
+ " -{ 123 MOV}- -{ srcvar MOV}-",
+ "",
+ " Lorsque l'entrée de cette instruction est vraie, elle va mettre la",
+ " variable de destination à une valeur égale à la variable source ou à",
+ " la constante source. Quand l'entrée de cette instruction est fausse",
+ " rien ne se passe. Vous pouvez affecter n'importe quelle variable",
+ " à une instruction de déplacement, ceci inclu l'état de variables",
+ " compteurs ou temporisateurs qui se distinguent par l'entête T ou",
+ " C. Par exemple mettre 0 dans Tsauvegardé équivaut à faire une RES",
+ " de la temporisation. Cette instruction doit être complétement à",
+ " droite dans une séquence.",
+ "",
+ "",
+ "> OPERATIONS ARITHMETIQUES {ADD kay :=} {SUB Ccnt :=}",
+ " -{ 'a' + 10 }- -{ Ccnt - 10 }-",
+ "",
+ "> {MUL dest :=} {DIV dv := }",
+ " -{ var * -990 }- -{ dv / -10000}-",
+ "",
+ " Quand l'entrée de cette instruction est vraie, elle place en",
+ " destination la variable égale à l'expression calculée. Les opérandes",
+ " peuvent être des variables (en incluant les variables compteurs et",
+ " tempos) ou des constantes. Ces instructions utilisent des valeurs 16",
+ " bits signées. Il faut se souvenir que le résultat est évalué à chaque",
+ " cycle tant que la condition d'entrée est vraie. Si vous incrémentez",
+ " ou décrémentez une variable (si la variable de destination est",
+ " aussi une des opérandes), le résultat ne sera pas celui escompté,",
+ " il faut utiliser typiquement un front montant ou descendant de la",
+ " condition d'entrée qui ne sera évalué qu'une seule fois. La valeur",
+ " est tronquée à la valeur entière. Cette instruction doit être",
+ " complétement à droite dans une séquence.",
+ "",
+ "",
+ "> COMPARER [var ==] [var >] [1 >=]",
+ " -[ var2 ]- -[ 1 ]- -[ Ton]-",
+ "",
+ "> [var /=] [-4 < ] [1 <=]",
+ " -[ var2 ]- -[ vartwo]- -[ Cup]-",
+ "",
+ " Si l'entrée de cette instruction est fausse alors la sortie est",
+ " fausse. Si l'entrée est vraie, alors la sortie sera vraie si et",
+ " uniquement si la condition de sortie est vraie. Cette instruction",
+ " est utilisée pour comparer (Egalité, plus grand que,plus grand ou",
+ " égal à, inégal, plus petit que, plus petit ou égal à) une variable à",
+ " une autre variable, ou pour comparer une variable avec une constante",
+ " 16 bits signée.",
+ "",
+ "",
+ "> COMPTEUR DECOMPTEUR Cnom Cnom",
+ " --[CTU >=5]-- --[CTD >=5]--",
+ "",
+ " Un compteur incrémente ( Compteur CTU, count up) ou décrémente",
+ " (Décompteur CTD, count down) une variable à chaque front montant de",
+ " la ligne en condition d'entrée (CAD quand la signal passe de l'état",
+ " 0 à l'état 1. La condition de sortie du compteur est vraie si la",
+ " variable du compteur est égale ou plus grande que 5 (dans l'exemple),",
+ " et faux sinon. La condition de sortie de la ligne peut être vraie,",
+ " même si la condition d'entrée est fausse, cela dépend uniquement de la",
+ " valeur de la variable du compteur. Vous pouvez avoir un compteur ou",
+ " un décompteur avec le même nom, qui vont incréménter ou decrémenter",
+ " une variable. L'instruction Remise à Zéro permet de resetter un",
+ " compteur (remettre à zéro), il est possible de modifier par des",
+ " opérations les variables des compteurs décompteurs.",
+ "",
+ "",
+ "> COMPTEUR CYCLIQUE Cnom",
+ " --{CTC 0:7}--",
+ "",
+ " Un compteur cyclique fonctionne comme un compteur normal",
+ " CTU, exception faite, lorsque le compteur arrive à sa",
+ " limite supérieure, la variable du compteur revient à 0. dans",
+ " l'exemple la valeur du compteur évolue de la façon suivante :",
+ " 0,1,2,4,5,6,7,0,1,2,3,4,5,6,7,0,1,3,4,5,etc. Ceci est très pratique",
+ " en conbinaison avec des intructions conditionnelles sur la variable",
+ " Cnom. On peut utiliser ceci comme un séquenceur, l'horloge du compteur",
+ " CTC est validée par la condition d'entrée associée à une instruction",
+ " de front montant.",
+ " Cette instruction doit être complétement à droite dans une séquence.",
+ " ",
+ "",
+ "> REGISTRE A DECALAGE {SHIFT REG }",
+ " -{ reg0..3 }-",
+ "",
+ " Un registre à décalage est associé avec un jeu de variables. Le",
+ " registre à décalage de l'exemple donné est associé avec les",
+ " variables`reg0', `reg1', `reg2', and `reg3'. L'entrée du registre à",
+ " décalage est `reg0'. A chaque front montant de la condition d'entrée",
+ " de la ligne, le registre à décalage va décaler d'une position à",
+ " droite. Ce qui donne `reg3 := reg2', `reg2 := reg1'. et `reg1 :=",
+ " reg0'.`reg0' est à gauche sans changement. Un registre à décalage",
+ " de plusieurs éléments peut consommer beaucoup de place en mémoire.",
+ " Cette instruction doit être complétement à droite dans une séquence.",
+ "",
+ "",
+ "> TABLEAU INDEXE {dest := }",
+ " -{ LUT[i] }-",
+ "",
+ " Un tableau indexé et un groupe ordonné de n valeurs Quand la condition",
+ " d'entrée est vraie, la variable entière `dest' est mise à la valeur",
+ " correspondand à l'index i du tableau. L'index est compris entre 0 et",
+ " (n-1). Le comportement de cette instruction est indéfini si l'index",
+ " est en dehors du tableau",
+ " Cette instruction doit être complétement à droite dans une séquence.",
+ "",
+ "",
+ "> TABLEAU ELEMENTS LINEAIRES {yvar := }",
+ " -{ PWL[xvar] }-",
+ "",
+ " C'est une bonne méthode pour évaluer de façon approximative une",
+ " fonction compliquée ou une courbe. Très pratique par exemple pour",
+ " appliquer une courbe de calibration pour linéariser tension de sortie",
+ " d'un capteur dans une unité convenable.",
+ "",
+ " Supposez que vous essayez de faire une fonction pour convertir une",
+ " variable d'entrée entière, x, en une variable de sortie entière, y,",
+ " vous connaissez la fonction en différents points, par exemple vous",
+ " connaissez :",
+ "",
+ " f(0) = 2",
+ " f(5) = 10",
+ " f(10) = 50",
+ " f(100) = 100",
+ "",
+ " Ceci donne les points",
+ "",
+ " (x0, y0) = ( 0, 2)",
+ " (x1, y1) = ( 5, 10)",
+ " (x2, y2) = ( 10, 50)",
+ " (x3, y3) = (100, 100)",
+ "",
+ " liés à cette courbe. Vous pouvez entrer ces 4 points dans un",
+ " tableau associé à l'instruction tableau d'éléments linéaires. Cette",
+ " instruction regarde la valeur de xvar et fixe la valeur de yvar",
+ " correspondante. Par exemple si vous mettez xvar = 10 , l'instruction",
+ " validera yvar = 50.",
+ "",
+ " Si vous mettez une instruction avec une valeur xvar entre deux valeurs",
+ " de x du tableau (et par conséquence aussi de yvar). Une moyenne",
+ " proportionnelle entre les deux valeurs , précédente et suivante de",
+ " xvar et de la valeur liée yvar, est effectuée. Par exemple xvar =",
+ " 55 donne en sortie yvar = 75 Les deux points xvar (10.50) et yvar",
+ " (50,75) , 55 est la moyenne entre 10 et 100 et 75 est la moyenne",
+ " entre 50 et 100, donc (55,75) sont liés ensemble par une ligne de",
+ " connection qui connecte ces deux points.",
+ "",
+ " Ces points doivent être spécifiés dans l'ordre ascendant des",
+ " coordonnées x. Il peut être impossible de faire certaines opérations",
+ " mathématiques nécessaires pour certains tableaux, utilisant des",
+ " entiers 16 bits. Dans ce LDmicro va provoquer une alarme. Ce tableau",
+ " va provoquer une erreur :",
+ "",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (300, 300)",
+ "",
+ " Vous pouvez supprimer ces erreurs en diminuant l'écart entre les",
+ " points du tableau, par exemple ce tableau est équivalent à celui ci",
+ " dessus , mais ne provoque pas d'erreur:",
+ "",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (150, 150)",
+ " (x2, y2) = (300, 300)",
+ "",
+ " Il n'est pratiquement jamais nécessaire d'utiliser plus de 5 ou",
+ " 6 points. Ajouter des points augmente la taille du code et diminue",
+ " sa vitesse d'exécution. Le comportement, si vous passez une valeur",
+ " à xvar plus grande que la plus grande valeur du tableau , ou plus",
+ " petit que la plus petite valeur, est indéfini.",
+ " Cette instruction doit être complétement à droite dans une séquence.",
+ "",
+ "",
+ "> LECTURE CONVERTISSEUR A/D Anom",
+ " --{READ ADC}--",
+ "",
+ " LDmicro peut générer du code pour utiliser les convertisseurs A/D",
+ " contenus dans certains microcontroleurs. Si la condition d'entrée",
+ " de l'instruction est vraie, alors une acquisition du convertisseur",
+ " A/D est éffectuée et stockée dans la variable Anom. Cette variable",
+ " peut être par la suite traitée comme les autres variables par les",
+ " différentes opérations arithmétiques ou autres. Vous devez affecter",
+ " une broche du micro à la variable Anom de la même façon que pour",
+ " les entrées et sorties digitales par un double clic dans la list",
+ " affichée au bas de l'écran. Si la condition d'entrée de la séquence",
+ " est fausse la variable Anom reste inchangée.",
+ "",
+ " Pour tous les circuits supportés actuellement, 0 volt en entrée",
+ " correspond à une lecture ADC de 0, et une valeur égale à VDD (la",
+ " tension d'alimentation ) correspond à une lecture ADC de 1023. Si",
+ " vous utilisez un circuit AVR, vous devez connecter Aref à VDD.",
+ "",
+ " Vous pouvez utiliser les opérations arithmétiques pour mettre à ",
+ " l'échelle les lectures effectuées dans l'unité qui vous est la plus ",
+ " appropriée. Mais souvenez vous que tous les calculs sont faits en ",
+ " utilisant les entiers.",
+ "",
+ " En général, toutes les broches ne sont pas utilisables pour les ",
+ " lecture de convertisseur A/D. Le logiciel ne vous permet pas ",
+ " d'affecter une broche non A/D pour une entrée convertisseur.",
+ " Cette instruction doit être complétement à droite dans une séquence.",
+ "",
+ "",
+ "> FIXER RAPPORT CYCLE PWM duty_cycle",
+ " -{PWM 32.8 kHz}-",
+ "",
+ " LDmicro peut générer du code pour utiliser les périphériques PWM",
+ " contenus dans certains microcontroleurs. Si la condition d'entrée",
+ " de cette instruction est vraie, le rapport de cycle du périphérique",
+ " PWM va être fixé à la valeur de la variable Rapport de cycle PWM.",
+ " Le rapport de cycle est un nombre compris entre 0 (toujours au",
+ " niveau bas) et 100 (toujours au niveau haut). Si vous connaissez la",
+ " manière dont les périphériques fonctionnent vous noterez que LDmicro",
+ " met automatiquement à l'échelle la variable du rapport de cycle en",
+ " pourcentage de la période d'horloge PWM.",
+ "",
+ " Vous pouvez spécifier la fréquence de sortie PWM, en Hertz. Le",
+ " fréquence que vous spécifiez peut ne pas être exactement accomplie, en",
+ " fonction des divisions de la fréquence d'horloge du microcontroleur,",
+ " LDmicro va choisir une fréquence approchée. Si l'erreur est trop",
+ " importante, il vous avertit.Les vitesses rapides sont au détriment",
+ " de la résolution. Cette instruction doit être complétement à droite",
+ " dans une séquence.",
+ "",
+ " Le runtime du language à contacts consomme un timers (du micro) pour",
+ " le temps de cycle, ce qui fait que le PWM est uniquement possible",
+ " avec des microcontroleurs ayant au moins deux timers utilisables.",
+ " PWM utilise CCP2 (pas CCP1) sur les PIC16F et OC2(pas OC1) sur les",
+ " Atmel AVR.",
+ "",
+ "> METTRE PERSISTANT saved_var",
+ " --{PERSIST}--",
+ "",
+ " Quand la condition d'entrée de cette instruction est vraie, la",
+ " variable entière spécifiée va être automatiquement sauvegardée en",
+ " EEPROM, ce qui fait que cette valeur persiste même après une coupure",
+ " de l'alimentation du micro. Il n'y a pas à spécifier ou elle doit",
+ " être sauvegardée en EEPROM, ceci est fait automatiquement, jusqu'a",
+ " ce quelle change à nouveau. La variable est automatiquement chargée",
+ " à partir de l'EEPROM suite à un reset à la mise sous tension.",
+ "",
+ " Si une variables, mise persistante, change fréquemment, l'EEPROM de",
+ " votre micro peut être détruite très rapidement, Le nombre de cycles",
+ " d'écriture dans l'EEPROM est limité à environ 100 000 cycles Quand",
+ " la condition est fausse, rien n'apparait. Cette instruction doit",
+ " être complétement à droite dans une séquence.",
+ "",
+ "",
+ "> RECEPTION UART (SERIE) var",
+ " --{UART RECV}--",
+ "",
+ " LDmicro peut générer du code pour utiliser l'UART, existant dans",
+ " certains microcontroleurs. Sur les AVR, avec de multiples UART,",
+ " uniquement l'UART1 est utilisable (pas l'UART0). Configurer la",
+ " vitesse en utilisant -> Paramètres -> Paramètres MCU. Toutes les",
+ " vitesses de liaison ne sont pas utilisables avec tous les quartz de",
+ " toutyes les fréquences. Ldmicro vous avertit dans ce cas.",
+ "",
+ " Si la condition d'entrée de cette instruction est fausse, rien ne se",
+ " passe. Si la condition d'entrée est vraie, elle essaie de recevoir",
+ " un caractère en provenance de l'UART. Si aucun caractère n'est lu",
+ " alors la condition de sortie devient fausse. Si un caractère est",
+ " lu la valeur ASCII est stockée dans 'var' et la condition de sortie",
+ " est vraie pour un seul cycle API.",
+ "",
+ "",
+ "> EMMISION UART (SERIE) var",
+ " --{UART SEND}--",
+ "",
+ " LDmicro peut générer du code pour utiliser l'UART, existant dans ",
+ " certains microcontroleurs. Sur les AVR, avec de multiples UART, ",
+ " uniquement l'UART1 est utilisable (pas l'UART0). Configurer la ",
+ " vitesse en utilisant -> Paramètres -> Paramètres MCU. Toutes les ",
+ " vitesses de liaison ne sont pas utilisables avec tous les quartz ",
+ " de toutyes les fréquences. Ldmicro vous avertit dans ce cas.",
+ "",
+ " Si la condition d'entrée de cette instruction est fausse, rien ne",
+ " se passe. Si la condition d'entrée est vraie alors cette instruction",
+ " écrit un seul caractère vers l'UART. La valeur ASCII du caractère à",
+ " transmettre doit avoir été stocké dans 'var' par avance. La condition",
+ " de sortie de la séquence est vraie, si l'UART est occupée (en cours",
+ " de transmission d'un caractère), et fausse sinon.",
+ "",
+ " Rappelez vous que les caractères mettent un certain temps pour être",
+ " transmis. Vérifiez la condition de sortie de cette instruction pour",
+ " vous assurer que le premier caractère à bien été transmis, avant",
+ " d'essayer d'envoyer un second caractère, ou utiliser une temporisation",
+ " pour insérer un délai entre caractères; Vous devez uniquement vérifier",
+ " que la condition d'entrée est vraie (essayez de transmettre un",
+ " caractère) quand la condition de sortie est fausse(UART non occuppée).",
+ "",
+ " Regardez l'instruction Chaine formattée(juste après) avant d'utiliser",
+ " cette instruction, elle est plus simple à utiliser, et dans la",
+ " majorité des cas, est capable de faire ce dont on a besoin.",
+ "",
+ "",
+ "> CHAINE FORMATTEE SUR UART var",
+ " -{\"Pression: \\3\\r\\n\"}-",
+ "",
+ " LDmicro peut générer du code pour utiliser l'UART, existant dans ",
+ " certains microcontroleurs. Sur les AVR, avec de multiples UART, ",
+ " uniquement l'UART1 est utilisable (pas l'UART0). Configurer la ",
+ " vitesse en utilisant -> Paramètres -> Paramètres MCU. Toutes les ",
+ " vitesses de liaison ne sont pas utilisables avec tous les quartz ",
+ " de toutyes les fréquences. Ldmicro vous avertit dans ce cas.",
+ "",
+ " Quand la condition d'entrée de cette instruction passe de faux à vrai,",
+ " elle commence à envoyer une chaine compléte vers le port série. Si",
+ " la chaine comporte la séquence spéciale '3', alors cette séquence",
+ " va être remplacée par la valeur de 'var', qui est automatiquement",
+ " converti en une chaine. La variable va être formattée pour prendre",
+ " exactement trois caractères; par exemple si var = 35, la chaine",
+ " exacte qui va être \"imprimée\" sera 'Pression: 35\\r\\n' (notez les",
+ " espaces supplémentaires). Si au lieu de cela var = 1432 , la sortie",
+ " est indéfinie parceque 1432 comporte plus de 3 digits. Dans ce cas",
+ " vous devez nécessairement utiliser '\\4' à la place.",
+ "",
+ " Si la variable peut être négative, alors utilisez '\\-3d' (ou `\\-4d'",
+ " etc.) à la place. Ceci oblige LDmicro à imprimer un espace d'entête",
+ " pour les nombres positifs et un signe moins d'entête pour les chiffres",
+ " négatifs.",
+ "",
+ " Si de multiples instructions de chaines formattées sont activées au",
+ " même moment (ou si une est activée avant de finir la précédente)",
+ " ou si ces instructions sont imbriquées avec des instructions TX",
+ " (transmission), le comportement est indéfini.",
+ "",
+ " Il est aussi possible d'utiliser cette instruction pour sortie une",
+ " chaine fixe, sans l'intervention d'une variable en valeur entière",
+ " dans le texte qui est envoyée sur la ligne série. Dans ce cas,",
+ " simplement ne pas inclure de séquence spéciale Escape.",
+ "",
+ " Utiliser `\\\\' pour l'anti-slash. en addition à une séquence escape ",
+ " pour intervenir sue une variables entière, les caractères de ",
+ " contrôles suivants sont utilisables :",
+ " ",
+ " * \\r -- retour en début de ligne",
+ " * \\n -- nouvelle ligne",
+ " * \\f -- saut de page",
+ " * \\b -- retour arrière",
+ " * \\xAB -- caractère avec valeur ASCII 0xAB (hex)",
+ "",
+ " La condition de sortie de cette instruction est vraie quand elle",
+ " transmet des données, sinon elle est fausse. Cette instruction",
+ " consomme une grande quantité de mémoire, elle doit être utilisée",
+ " avec modération. L'implémentation présente n'est pas efficace, mais",
+ " une meilleure implémentation demanderait une modification de tout",
+ " le reste.",
+ "",
+ "NOTE CONCERNANT LES MATHS",
+ "=========================",
+ "",
+ "Souvenez vous que LDmicro travaille uniquement en mathématiques entiers",
+ "16 bits. Ce qui fait que le résultat final de même que tous les calculs",
+ "mêmes intermédiaires seront compris entre -32768 et 32767.",
+ "",
+ "Par exemple, si vous voulez calculer y = (1/x)*1200,ou x est compris",
+ "entre 1 et 20, ce qui donne un résultat entre 1200 et 60,le résultat est",
+ "bien à l'intérieur d'un entier 16 bits, il doit donc être théoriquement",
+ "possible de faire le calcul. Nous pouvons faire le calcul de deux façons",
+ "d'abord faire 1/x et ensuite la multiplication:",
+ "",
+ " || {DIV temp :=} ||",
+ " ||---------{ 1 / x }----------||",
+ " || ||",
+ " || {MUL y := } ||",
+ " ||----------{ temp * 1200}----------||",
+ " || ||",
+ "",
+ "Ou uniquement faire simplement la division en une seule ligne :",
+ "",
+ " || {DIV y :=} ||",
+ " ||-----------{ 1200 / x }-----------||",
+ "",
+ "Mathématiquement c'est identique, la première donne y = 0 , c'est à dire",
+ "une mauvais résultat, si nous prenons par exemple x = 3 , 1/x = 0.333 mais",
+ "comme il s'agit d'un entier, la valeur pour Temp est de 0 et 0*1200 = 0 ",
+ "donc résultat faux.Dans le deuxième cas, il n'y a pas de résultat ",
+ "intermédiaire et le résultat est correct dans tous les cas.",
+ "",
+ "Si vous trouvez un problème avec vos calculs mathématiques, vérifiez les",
+ "résultats intermédiaires, si il n'y a pas de dépassement de capacités par",
+ "rapports aux valeurs entières. (par exemple 32767 + 1 = -32768). Quand",
+ "cela est possible essayer de choisir des valeurs entre -100 et 100.",
+ "",
+ "Vous pouvez utiliser un certain facteur de multiplication ou division pour ",
+ "mettre à l'echelle les variables lors de calculs par exemple : pour mettre",
+ "mettre à l'echelle y = 1.8*x , il est possible de faire y =(9/5)*x ",
+ "(9/5 = 1.8) et coder ainsi y = (9*x)/5 en faisant d'abord la multiplication",
+ "",
+ " || {MUL temp :=} ||",
+ " ||---------{ x * 9 }----------||",
+ " || ||",
+ " || {DIV y :=} ||",
+ " ||-----------{ temp / 5 }-----------||",
+ "",
+ "Ceci fonctionne tant que x < (32767 / 9), or x < 3640. Pour les grandes ",
+ "valeurs de x,la variable `temp' va se mettre en dépassement. Ceci est ",
+ "similaire vers la limite basse de x.",
+ "",
+ "",
+ "STYLE DE CODIFICATION",
+ "=====================",
+ "",
+ "Il est permis d'avoir plusieurs bobines en parallèle, contrôlées par",
+ "une simple ligne comme ci-dessous :",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || Xb Yb ||",
+ " ||-------] [------+-------( )-------||",
+ " || | ||",
+ " || | Yc ||",
+ " || +-------( )-------||",
+ " || ||",
+ "",
+ "à la place de ceci :",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yb ||",
+ " 2 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yc ||",
+ " 3 ||-------] [--------------( )-------||",
+ " || ||",
+ "",
+ "Il est permis théoriquement d'écrire un programme avec une séquence très",
+ "importante et de ne pas utiliser plusieurs lignes pour la faire. En",
+ "pratique c'est une mauvaise idée, à cause de la compléxité que cela",
+ "peut engendrer et plus difficile à éditer sans effacer et redessiner un",
+ "certain nombre d'éléments de logique.",
+ "",
+ "Néanmoins, c'est une bonne idée de regrouper différents éléments d'un bloc",
+ "logique dans une seule séquence. Le code généré est identique dans les",
+ "deux cas, et vous pouvez voir ce que fait la séquence dans le diagramme",
+ "à contacts.",
+ "",
+ " * * *",
+ "",
+ "En général, il est considéré comme mauvais d'écrire du code dont la",
+ "sortie dépend de l'ordre d'exécution. Exemple : ce code n'est pas très",
+ "bon lorsque xa et xb sont vrai en même temps :",
+ "",
+ " || Xa {v := } ||",
+ " 1 ||-------] [--------{ 12 MOV}--||",
+ " || ||",
+ " || Xb {v := } ||",
+ " ||-------] [--------{ 23 MOV}--||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || [v >] Yc ||",
+ " 2 ||------[ 15]-------------( )-------||",
+ " || ||",
+ "",
+ "Ci-dessous un exemple pour convertir 4 bits Xb3:0 en un entier :",
+ "",
+ " || {v := } ||",
+ " 3 ||-----------------------------------{ 0 MOV}--||",
+ " || ||",
+ " || Xb0 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 1 }-----------||",
+ " || ||",
+ " || Xb1 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 2 }-----------||",
+ " || ||",
+ " || Xb2 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 4 }-----------||",
+ " || ||",
+ " || Xb3 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 8 }-----------||",
+ " || ||",
+ "",
+ "Si l'instruction MOV est déplacée en dessous des instructions ADD, la",
+ "valeur de la variable v, quand elle est lue autrepart dans le programme,",
+ "serait toujours 0. La sortie du code dépend alors de l'ordre d'évaluations",
+ "des instructions. Ce serait possible de modifier ce code pour éviter cela,",
+ "mais le code deviendrait très encombrant.",
+ "",
+ "DEFAUTS",
+ "=======",
+ "",
+ "LDmicro ne génére pas un code très efficace; il est lent à exécuter et",
+ "il est gourmand en Flash et RAM. Un PIC milieu de gamme ou un AVR peut",
+ "tout de même faire ce qu'un petit automate peut faire.",
+ "",
+ "La longueur maximum des noms de variables est très limitée, ceci pour",
+ "être intégrée correctement dans le diagramme logique, je ne vois pas de",
+ "solution satisfaisante pour solutionner ce problème.",
+ "",
+ "Si votre programme est trop important, vitesse exécution, mémoire",
+ "programme ou contraintes de mémoire de données pour le processeur que vous",
+ "avez choisi, il n'indiquera probablement pas d'erreur. Il se blocquera",
+ "simplement quelque part.",
+ "",
+ "Si vous êtes programmeur négligent dans les sauvegardes et les",
+ "chargements, il est possible qu'un crash se produise ou exécute un code",
+ "arbitraire corrompu ou un mauvais fichier .ld .",
+ "",
+ "SVP, faire un rapport sur les bogues et les demandes de modifications.",
+ "",
+ "Thanks to:",
+ " * Marcelo Solano, for reporting a UI bug under Win98",
+ " * Serge V. Polubarjev, for not only noticing that RA3:0 on the",
+ " PIC16F628 didn't work but also telling me how to fix it",
+ " * Maxim Ibragimov, for reporting and diagnosing major problems",
+ " with the till-then-untested ATmega16 and ATmega162 targets",
+ " * Bill Kishonti, for reporting that the simulator crashed when the",
+ " ladder logic program divided by zero",
+ " * Mohamed Tayae, for reporting that persistent variables were broken",
+ " on the PIC16F628",
+ " * David Rothwell, for reporting several user interface bugs and a",
+ " problem with the \"Export as Text\" function",
+ "",
+ "Particular thanks to Marcel Vaufleury, for this translation (of both",
+ "the manual and the program's user interface) into French.",
+ "",
+ "",
+ "COPYING, AND DISCLAIMER",
+ "=======================",
+ "",
+ "DO NOT USE CODE GENERATED BY LDMICRO IN APPLICATIONS WHERE SOFTWARE",
+ "FAILURE COULD RESULT IN DANGER TO HUMAN LIFE OR DAMAGE TO PROPERTY. THE",
+ "AUTHOR ASSUMES NO LIABILITY FOR ANY DAMAGES RESULTING FROM THE OPERATION",
+ "OF LDMICRO OR CODE GENERATED BY LDMICRO.",
+ "",
+ "This program is free software: you can redistribute it and/or modify it",
+ "under the terms of the GNU General Public License as published by the",
+ "Free Software Foundation, either version 3 of the License, or (at your",
+ "option) any later version.",
+ "",
+ "This program is distributed in the hope that it will be useful, but",
+ "WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY",
+ "or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License",
+ "for more details.",
+ "",
+ "You should have received a copy of the GNU General Public License along",
+ "with this program. If not, see <http://www.gnu.org/licenses/>.",
+ "",
+ "",
+ "Jonathan Westhues",
+ "",
+ "Rijswijk -- Dec 2004",
+ "Waterloo ON -- Jun, Jul 2005",
+ "Cambridge MA -- Sep, Dec 2005",
+ " Feb, Mar 2006",
+ "",
+ "Email: user jwesthues, at host cq.cx",
+ "",
+ "",
+ NULL
+};
+#endif
+
+#ifdef LDLANG_TR
+char *HelpTextTr[] = {
+ "",
+ "KULLANIM KÝTAPÇIÐI",
+ "==================",
+ "LDMicro desteklenen MicroChip PIC16 ve Atmel AVR mikrokontrolcüler için ",
+ "gerekli kodu üretir. Bu iþ için kullanýlabilecek deðiþik programlar vardýr.",
+ "Örneðin BASIC, C, assembler gibi. Bu programlar kendi dillerinde yazýlmýþ",
+ "programlarý iþlemcilerde çalýþabilecek dosyalar haline getirirler.",
+ "",
+ "PLC'de kullanýlan dillerden biri ladder diyagramýdýr. Aþaðýda LDMicro ile",
+ "yazýlmýþ basit bir program görülmektedir.",
+ "",
+ " || ||",
+ " || Xbutton1 Tdon Rchatter Yred ||",
+ " 1 ||-------]/[---------[TON 1.000 s]-+-------]/[--------------( )-------||",
+ " || | ||",
+ " || Xbutton2 Tdof | ||",
+ " ||-------]/[---------[TOF 2.000 s]-+ ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Rchatter Ton Tnew Rchatter ||",
+ " 2 ||-------]/[---------[TON 1.000 s]----[TOF 1.000 s]---------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " ||------[END]---------------------------------------------------------||",
+ " || ||",
+ " || ||",
+ "",
+ "(TON=turn-on gecikme; TOF-turn-off gecikme. --] [-- giriþler, diðer bir ",
+ "deyiþle kontaklardýr. --( )-- ise çýkýþlardýr. Bunlar bir rölenin bobini ",
+ "gibi davranýrlar. Ladder diyagramý ile ilgili bol miktarda kaynak internet",
+ "üzerinde bulunmaktadýr. Burada LDMicro'ya has özelliklerden bahsedeceðiz.",
+ "",
+ "LDmicro ladder diyagramýný PIC16 veya AVR koduna çevirir. Aþaðýda desteklenen",
+ "iþlemcilerin listesi bulunmaktadýr:",
+ " * PIC16F877",
+ " * PIC16F628",
+ " * PIC16F876 (denenmedi)",
+ " * PIC16F88 (denenmedi)",
+ " * PIC16F819 (denenmedi)",
+ " * PIC16F887 (denenmedi)",
+ " * PIC16F886 (denenmedi)",
+ " * ATmega128",
+ " * ATmega64",
+ " * ATmega162 (denenmedi)",
+ " * ATmega32 (denenmedi)",
+ " * ATmega16 (denenmedi)",
+ " * ATmega8 (denenmedi)",
+ "",
+ "Aslýnda daha fazla PIC16 ve AVR iþlemci desteklenebilir. Ancak test ettiklerim",
+ "ve desteklediðini düþündüklerimi yazdým. Örneðin PIC16F648 ile PIC16F628 ",
+ "arasýnda fazla bir fark bulunmamaktadýr. Eðer bir iþlemcinin desteklenmesini",
+ "istiyorsanýz ve bana bildirirseniz ilgilenirim.",
+ "",
+ "LDMicro ile ladder diyagramýný çizebilir, devrenizi denemek için gerçek zamanlý ",
+ "simülasyon yapabilirsiniz. Programýnýzýn çalýþtýðýndan eminseniz programdaki ",
+ "giriþ ve çýkýþlara mikrokontrolörün bacaklarýný atarsýnýz. Ýþlemci bacaklarý ",
+ "belli olduktan sonra programýnýzý derleyebilirsiniz. Derleme sonucunda oluþan",
+ "dosya .hex dosyasýdýr. Bu dosyayý PIC/AVR programlayýcý ile iþlemcinize kaydedersiniz.",
+ "PIC/AVR ile uðraþanlar konuya yabancý deðildir.",
+ "",
+ "",
+ "LDMicro ticari PLC programlarý gibi tasarlanmýþtýr. Bazý eksiklikler vardýr. ",
+ "Kitapçýðý dikkatlice okumanýzý tavsiye ederim. Kullaným esnasýnda PLC ve ",
+ "PIC/AVR hakkýnda temel bilgilere sahip olduðunuz düþünülmüþtür.",
+ "",
+ "DÝÐER AMAÇLAR",
+ "==================",
+ "",
+ "ANSI C kodunu oluþturmak mümkündür. C derleyicisi olan herhangi bir",
+ "iþlemci için bu özellikten faydalanabilirsiniz. Ancak çalýþtýrmak için ",
+ "gerekli dosyalarý siz saðlamalýsýnýz. Yani, LDMicro sadece PlcCycle()",
+ "isimli fonksiyonu üretir. Her döngüde PlcCycle fonksiyonunu çaðýrmak, ve",
+ "PlcCycle() fonksiyonunun çaðýrdýðý dijital giriþi yazma/okuma vs gibi",
+ "G/Ç fonksiyonlarý sizin yapmanýz gereken iþlemlerdir.",
+ "Oluþturulan kodu incelerseniz faydalý olur.",
+ "",
+ "KOMUT SATIRI SEÇENEKLERÝ",
+ "========================",
+ "",
+ "Normal þartlarda ldmicro.exe komut satýrýndan seçenek almadan çalýþýr.",
+ "LDMicro'ya komut satýrýndan dosya ismi verebilirsiniz. Örneðin;komut",
+ "satýrýndan 'ldmicro.exe asd.ld' yazarsanýz bu dosya açýlmaya çalýþýrlýr.",
+ "Dosya varsa açýlýr. Yoksa hata mesajý alýrsýnýz. Ýsterseniz .ld uzantýsýný",
+ "ldmicro.exe ile iliþkilendirirseniz .ld uzantýlý bir dosyayý çift týklattýðýnýzda",
+ "bu dosya otomatik olarak açýlýr. Bkz. Klasör Seçenekleri (Windows).",
+ "",
+ "`ldmicro.exe /c src.ld dest.hex', þeklinde kullanýlýrsa src.ld derlenir",
+ "ve hazýrlanan derleme dest.hex dosyasýna kaydedilir. Ýþlem bitince LDMicro kapanýr.",
+ "Oluþabilecek tüm mesajlar konsoldan görünür.",
+ "",
+ "TEMEL BÝLGÝLER",
+ "==============",
+ "",
+ "LDMicro açýldýðýnda boþ bir program ile baþlar. Varolan bir dosya ile baþlatýrsanýz",
+ "bu program açýlýr. LDMicro kendi dosya biçimini kullandýðýndan diðer dosya",
+ "biçimlerinden dosyalarý açamazsýnýz.",
+ "",
+ "Boþ bir dosya ile baþlarsanýz ekranda bir tane boþ satýr görürsünüz. Bu satýra",
+ "komutlarý ekleyebilir, satýr sayýsýný artýrabilirsiniz. Satýrlara Rung denilir.",
+ "Örneðin; Komutlar->Kontak Ekle diyerek bir kontak ekleyebilirsiniz. Bu kontaða",
+ "'Xnew' ismi verilir. 'X' bu kontaðýn iþlemcinin bacaðýna denk geldiðini gösterir.",
+ "Bu kontaða derlemeden önce isim vermeli ve mikrokontrolörün bir bacaðý ile",
+ "eþleþtirmelisiniz. Eþleþtirme iþlemi içinde önce iþlemciyi seçmelisiniz.",
+ "Elemanlarýn ilk harfi o elemanýn ne olduðu ile ilgilidir. Örnekler:",
+ "",
+ " * Xname -- mikrokontrolördeki bir giriþ bacaðý",
+ " * Yname -- mikrokontrolördeki bir çýkýþ bacaðý",
+ " * Rname -- `dahili röle': hafýzada bir bit.",
+ " * Tname -- zamanlayýcý; turn-on, turn-off yada retentive ",
+ " * Cname -- sayýcý, yukarý yada aþaðý sayýcý",
+ " * Aname -- A/D çeviriciden okunan bir tamsayý deðer",
+ " * name -- genel deðiþken (tamsayý)",
+ "",
+ "Ýstediðiniz ismi seçebilirsiniz. Seçilen bir isim nerede kullanýlýrsa",
+ "kullanýlsýn ayný yere denk gelir. Örnekler; bir satýrda Xasd kullandýðýnýzda",
+ "bir baþka satýrda Xasd kullanýrsanýz ayný deðere sahiptirler. ",
+ "Bazen bu mecburi olarak kullanýlmaktadýr. Ancak bazý durumlarda hatalý olabilir.",
+ "Mesela bir (TON) Turn-On Gecikmeye Tgec ismini verdikten sonra bir (TOF)",
+ "Turn_Off gecikme devresine de Tgec ismini verirseniz hata yapmýþ olursunuz.",
+ "Dikkat ederseniz yaptýðýnýz bir mantýk hatasýdýr. Her gecikme devresi kendi",
+ "hafýzasýna sahip olmalýdýr. Ama Tgec (TON) turn-on gecikme devresini sýfýrlamak",
+ "için kullanýlan RES komutunda Tgec ismini kullanmak gerekmektedir.",
+ "",
+ "Deðiþken isimleri harfleri, sayýlarý, alt çizgileri ihtiva edebilir.",
+ "(_). Deðiþken isimleri sayý ile baþlamamalýdýr. Deðiþken isimleri büyük-küçük harf duyarlýdýr.",
+ "Örneðin; TGec ve Tgec ayný zamanlayýcýlar deðildir.",
+ "",
+ "",
+ "Genel deðiþkenlerle ilgili komutlar (MOV, ADD, EQU vs) herhangi bir",
+ "isimdeki deðiþkenlerle çalýþýr. Bunun anlamý bu komutlar zamanlayýcýlar",
+ "ve sayýcýlarla çalýþýr. Zaman zaman bu faydalý olabilir. Örneðin; bir ",
+ "zamanlayýcýnýn deðeri ile ilgili bir karþýlaþtýrma yapabilirsiniz.",
+ "",
+ "Deðiþkenler hr zaman için 16 bit tamsayýdýr. -32768 ile 32767 arasýnda",
+ "bir deðere sahip olabilirler. Her zaman için iþaretlidir. (+ ve - deðere",
+ "sahip olabilirler) Onluk sayý sisteminde sayý kullanabilirsiniz. Týrnak",
+ "arasýna koyarak ('A', 'z' gibi) ASCII karakterler kullanabilirsiniz.",
+ "",
+ "Ekranýn alt tarafýndaki kýsýmda kullanýlan tüm elemanlarýn bir listesi görünür.",
+ "Bu liste program tarafýndan otomatik olarak oluþturulur ve kendiliðinden",
+ "güncelleþtirilir. Sadece 'Xname', 'Yname', 'Aname' elemanlarý için",
+ "mikrokontrolörün bacak numaralarý belirtilmelidir. Önce Ayarlar->Ýþlemci Seçimi",
+ "menüsünden iþlemciyi seçiniz. Daha sonra G/Ç uçlarýný çift týklatarak açýlan",
+ "pencereden seçiminizi yapýnýz.",
+ "",
+ "Komut ekleyerek veya çýkararak programýnýzý deðiþtirebilirsiniz. Programdaki",
+ "kursör eleman eklenecek yeri veya hakkýnda iþlem yapýlacak elemaný göstermek",
+ "amacýyla yanýp söner. Elemanlar arasýnda <Tab> tuþu ile gezinebilirsiniz. Yada",
+ "elemaný fare ile týklatarak iþlem yapýlacak elemaný seçebilirsiniz. Kursör elemanýn",
+ "solunda, saðýnda, altýnda ve üstünde olabilir. Solunda ve saðýnda olduðunda",
+ "ekleme yaptýðýnýzda eklenen eleman o tarafa eklenir. Üstünde ve altýnda iken",
+ "eleman eklerseniz eklenen eleman seçili elemana paralel olarak eklenir.",
+ "Bazý iþlemleri yapamazsýnýz. Örneðin bir bobinin saðýna eleman ekleyemezsiniz.",
+ "LDMicro buna izin vermeyecektir.",
+ "",
+ "Program boþ bir satýrla baþlar. Kendiniz alta ve üste satýr ekleyerek dilediðiniz",
+ "gibi diyagramýnýzý oluþturabilirsiniz. Yukarýda bahsedildiði gibi alt devreler",
+ "oluþturabilirsiniz.",
+ "",
+ "Programýnýz yazdýðýnýzda simülasyon yapabilir, .hex dosyasýný oluþturabilirsiniz.",
+ "",
+ "SÝMÜLASYON",
+ "==========",
+ "",
+ "Simülasyon moduna geçmek için Simülasyon->Simülasyon modu menüsünü týklatabilir,",
+ "yada <Ctrl+M> tuþ kombinasyonuna basabilirsiniz. Simülasyon modunda program",
+ "farklý bir görüntü alýr. Kursör görünmez olur. Enerji alan yerler ve elemanlar",
+ "parlak kýrmýzý, enerji almayan yerler ve elemanlar gri görünür. Boþluk tuþuna",
+ "basarak bir çevrim ilerleyebilir yada menüden Simülasyon->Gerçek Zamanlý Simülasyonu Baþlat",
+ "diyerek (veya <Ctrl+R>) devamlý bir çevrim baþlatabilirsiniz. Ladder diyagramýnýn",
+ "çalýþmasýna göre gerçek zamanlý olarak elemanlar ve yollar program tarafýndan deðiþtirilir.",
+ "",
+ "Giriþ elemanlarýnýn durumunu çift týklatarak deðiþtirebilirsiniz. Mesela, 'Xname'",
+ "kontaðýný çift týklatýranýz açýktan kapalýya veya kapalýdan açýða geçiþ yapar.",
+ "",
+ "DERLEME",
+ "=======",
+ "",
+ "Ladder diyagramýnýn yapýlmasýndaki amaç iþlemciye yüklenecek .hex dosyasýnýn",
+ "oluþturulmasýdýr. Buna 'derleme' denir. Derlemeden önce þu aþamalar tamamlanmalýdýr:",
+ " 1- Ýþlemci seçilmelidir. Ayarlar->Ýþlemci Seçimi menüsünden yapýlýr.",
+ " 2- G/Ç uçlarýnýn mikrokontrolördeki hangi bacaklara baðlanacaðý seçilmelidir.",
+ " Elemanýn üzerine çift týklanýr ve çýkan listeden seçim yapýlýr.",
+ " 3- Çevrim süresi tanýmlanmalýdýr. Ayarlar->Ýþlemci Ayarlarý menüsünden yapýlýr.",
+ " Bu süre iþlemcinin çalýþtýðý frekansa baðlýdýr. Çoðu uygulamalar için 10ms",
+ " uygun bir seçimdir. Ayný yerden kristal frekansýný ayarlamayý unutmayýnýz.",
+ "",
+ "Artýk kodu üretebilirsiniz. Derle->Derle yada Derle->Farklý Derle seçeneklerinden",
+ "birini kullanacaksýnýz. Aradaki fark Kaydet ve Farklý Kaydet ile aynýdýr. Sonuçta",
+ "Intel IHEX dosyanýz programýnýzda hata yoksa üretilecektir. Programýnýzda hata varsa",
+ "uyarý alýrsýnýz.",
+ "",
+ "Progamlayýcýnýz ile bu dosyayý iþlemcinize yüklemelisiniz. Buradaki en önemli nokta",
+ "iþlemcinin konfigürasyon bitlerinin ayarlanmasýdýr. PIC16 iþlemciler için gerekli ",
+ "ayar bilgileri hex dosyasýna kaydedildiðinden programlayýcýnýz bu ayarlarý algýlayacaktýr.",
+ "Ancak AVR iþlemciler için gerekli ayarlarý siz yapmalýsýnýz.",
+ "",
+ "KOMUTLAR ve ELEMANLAR",
+ "=====================",
+ "",
+ "> KONTAK, NORMALDE AÇIK Xname Rname Yname",
+ " ----] [---- ----] [---- ----] [----",
+ "",
+ " Normalde açýk bir anahtar gibi davranýr. Komutu kontrol eden sinyal 0 ise ",
+ " çýkýþýndaki sinyalde 0 olur. Eðer kontrol eden sinyal 1 olursa çýkýþý da 1",
+ " olur ve çýkýþa baðlý bobin aktif olur. Bu kontak iþlemci bacaðýndan alýnan",
+ " bir giriþ, çýkýþ bacaðý yada dahili bir röle olabilir.",
+ "",
+ "",
+ "> KONTAK, NORMALDE KAPALI Xname Rname Yname",
+ " ----]/[---- ----]/[---- ----]/[----",
+ "",
+ " Normalde kapalý bir anahtar gibi davranýr. Komutun kontrol eden sinyal 0 ise",
+ " çýkýþý 1 olur. Eðer kontrol eden sinyal 1 olursa çýkýþý 0 olur ve çýkýþa",
+ " baðlý elemanlar pasif olur. Normalde çýkýþa gerilim verilir, ancak bu kontaðý ",
+ " kontrol eden sinyal 1 olursa kontaðýn çýkýþýnda gerilim olmaz. Bu kontak ",
+ " iþlemci bacaðýndan alýnan bir giriþ, çýkýþ bacaðý yada dahili bir röle olabilir",
+ "",
+ "",
+ "> BOBÝN, NORMAL Rname Yname",
+ " ----( )---- ----( )----",
+ "",
+ " Elemana giren sinyal 0 ise dahili röle yada çýkýþ bacaðý 0 yapýlýr.",
+ " Elemana giren sinyal 1 ise dahili röle yada çýkýþ bacaðý 1 yapýlýr.",
+ " Bobine giriþ deðiþkeni atamak mantýksýzdýr. Bu eleman bir satýrda",
+ " saðdaki en son eleman olmalýdýr.",
+ "",
+ "",
+ "> BOBÝN, TERSLENMÝÞ Rname Yname",
+ " ----(/)---- ----(/)----",
+ "",
+ " Elemana giren sinyal 0 ise dahili röle yada çýkýþ bacaðý 1 yapýlýr.",
+ " Elemana giren sinyal 1 ise dahili röle yada çýkýþ bacaðý 0 yapýlýr.",
+ " Bobine giriþ deðiþkeni atamak mantýksýzdýr. Bu eleman bir satýrda",
+ " saðdaki en son eleman olmalýdýr. Normal bobinin tersi çalýþýr.",
+ " ",
+ "",
+ "> BOBÝN, SET Rname Yname",
+ " ----(S)---- ----(S)----",
+ "",
+ " Elemana giren sinyal 1 ise dahili röle yada çýkýþ bacaðý 1 yapýlýr.",
+ " Diðer durumlarda bu bobinin durumunda bir deðiþiklik olmaz. Bu komut",
+ " bobinin durumunu sadece 0'dan 1'e çevirir. Bu nedenle çoðunlukla",
+ " BOBÝN-RESET ile beraber çalýþýr. Bu eleman bir satýrda saðdaki en",
+ " son eleman olmalýdýr.",
+ "",
+ "",
+ "> BOBÝN, RESET Rname Yname",
+ " ----(R)---- ----(R)----",
+ "",
+ " Elemana giren sinyal 1 ise dahili röle yada çýkýþ bacaðý 0 yapýlýr.",
+ " Diðer durumlarda bu bobinin durumunda bir deðiþiklik olmaz. Bu komut",
+ " bobinin durumunu sadece 1'dEn 0'a çevirir. Bu nedenle çoðunlukla",
+ " BOBÝN-SET ile beraber çalýþýr. Bu eleman bir satýrda saðdaki en",
+ " son eleman olmalýdýr.",
+ "",
+ "",
+ "> TURN-ON GECÝKME Tdon ",
+ " -[TON 1.000 s]-",
+ "",
+ " Bir zamanlayýcýdýr. Giriþindeki sinyal 0'dan 1'e geçerse ayarlanan",
+ " süre kadar sürede çýkýþ 0 olarak kalýr, süre bitince çýkýþý 1 olur. ",
+ " Giriþindeki sinyal 1'den 0'a geçerse çýkýþ hemen 0 olur.",
+ " Giriþi 0 olduðu zaman zamanlayýcý sýfýrlanýr. Ayrýca; ayarlanan süre",
+ " boyunca giriþ 1 olarak kalmalýdýr.",
+ "",
+ " Zamanlayýcý 0'dan baþlayarak her çevrim süresinde 1 artarak sayar.",
+ " Sayý ayarlanan süreye eþit yada büyükse çýkýþ 1 olur. Zamanlayýcý",
+ " deðiþkeni üzerinde iþlem yapmak mümkündür. (Örneðin MOV komutu ile)",
+ "",
+ "",
+ "> TURN-OFF GECÝKME Tdoff ",
+ " -[TOF 1.000 s]-",
+ "",
+ " Bir zamanlayýcýdýr. Giriþindeki sinyal 1'den 0'a geçerse ayarlanan",
+ " süre kadar sürede çýkýþ 1 olarak kalýr, süre bitince çýkýþý 0 olur. ",
+ " Giriþindeki sinyal 0'dan 1'e geçerse çýkýþ hemen 1 olur.",
+ " Giriþi 0'dan 1'e geçtiðinde zamanlayýcý sýfýrlanýr. Ayrýca; ayarlanan",
+ " süre boyunca giriþ 0 olarak kalmalýdýr.",
+ "",
+ " Zamanlayýcý 0'dan baþlayarak her çevrim süresinde 1 artarak sayar.",
+ " Sayý ayarlanan süreye eþit yada büyükse çýkýþ 1 olur. Zamanlayýcý",
+ " deðiþkeni üzerinde iþlem yapmak mümkündür. (Örneðin MOV komutu ile)",
+ "",
+ "",
+ "> SÜRE SAYAN TURN-ON GECÝKME Trto ",
+ " -[RTO 1.000 s]-",
+ "",
+ " Bu zamanlayýcý giriþindeki sinyalin ne kadar süre ile 1 olduðunu",
+ " ölçer. Ayaralanan süre boyunca giriþ 1 ise çýkýþý 1 olur. Aksi halde",
+ " çýkýþý 0 olur. Ayarlanan süre devamlý olmasý gerekmez. Örneðin; süre ",
+ " 1 saniyeye ayarlanmýþsa ve giriþ önce 0.6 sn 1 olmuþsa, sonra 2.0 sn",
+ " boyunca 0 olmuþsa daha sonra 0.4 sn boyunca giriþ tekrar 1 olursa",
+ " 0.6 + 0.4 = 1sn olduðundan çýkýþ 1 olur. Çýkýþ 1 olduktan sonra",
+ " giriþ 0 olsa dahi çýkýþ 0'a dönmez. Bu nedenle zamanlayýcý RES reset",
+ " komutu ile resetlenmelidir.",
+ "",
+ " Zamanlayýcý 0'dan baþlayarak her çevrim süresinde 1 artarak sayar.",
+ " Sayý ayarlanan süreye eþit yada büyükse çýkýþ 1 olur. Zamanlayýcý",
+ " deðiþkeni üzerinde iþlem yapmak mümkündür. (Örneðin MOV komutu ile)",
+ "",
+ "",
+ "> RESET (SAYICI SIFIRLAMASI) Trto Citems",
+ " ----{RES}---- ----{RES}----",
+ "",
+ " Bu komut bir zamanlayýcý veya sayýcýyý sýfýrlar. TON ve TOF zamanlayýcý",
+ " komutlarý kendiliðinden sýfýrlandýðýndan bu komuta ihtiyaç duymazlar.",
+ " RTO zamanlayýcýsý ve CTU/CTD sayýcýlarý kendiliðinden sýfýrlanmadýðýndan",
+ " sýfýrlanmalarý için kullanýcý tarafýndan bu komutile sýfýrlanmasý",
+ " gerekir. Bu komutun giriþi 1 olduðunda sayýcý/zamanlayýcý sýfýrlanýr.",
+ " Bu komut bir satýrýn saðýndaki son komut olmalýdýr.",
+ "",
+ "",
+ "> YÜKSELEN KENAR _",
+ " --[OSR_/ ]--",
+ "",
+ " Bu komutun çýkýþý normalde 0'dýr. Bu komutun çýkýþýnýn 1 olabilmesi",
+ " için bir önceki çevrimde giriþinin 0 þimdiki çevrimde giriþinin 1 ",
+ " olmasý gerekir. Komutun çýkýþý bir çevrimlik bir pals üretir.",
+ " Bu komut bir sinyalin yükselen kenarýnda bir tetikleme gereken",
+ " uygulamalarda faydalýdýr.",
+ " ",
+ "",
+ "> DÜÞEN KENAR _",
+ " --[OSF \\_]--",
+ "",
+ " Bu komutun çýkýþý normalde 0'dýr. Bu komutun çýkýþýnýn 1 olabilmesi",
+ " için bir önceki çevrimde giriþinin 1 þimdiki çevrimde giriþinin 0 ",
+ " olmasý gerekir. Komutun çýkýþý bir çevrimlik bir pals üretir.",
+ " Bu komut bir sinyalin düþen kenarýnda bir tetikleme gereken",
+ " uygulamalarda faydalýdýr.",
+ "",
+ "",
+ "> KISA DEVRE, AÇIK DEVRE",
+ " ----+----+---- ----+ +----",
+ "",
+ " Kýsa devrenin çýkýþý her zaman giriþinin aynýsýdýr.",
+ " Açýk devrenin çýkýþý her zaman 0'dýr. Bildiðimiz açýk/kýsa devrenin",
+ " aynýsýdýr. Genellikle hata aramada kullanýlýrlar.",
+ "",
+ "> ANA KONTROL RÖLESÝ",
+ " -{MASTER RLY}-",
+ "",
+ " Normalde her satýrýn ilk giriþi 1'dir. Birden fazla satýrýn tek bir þart ile ",
+ " kontrol edilmesi gerektiðinde paralel baðlantý yapmak gerekir. Bu ise zordur.",
+ " Bu iþlemi kolayca yapabilmek için ana kontrol rölesini kullanabiliriz.",
+ " Ana kontrol rölesi eklendiðinde kendisinden sonraki satýrlar bu röleye baðlý",
+ " hale gelir. Böylece; birden fazla satýr tek bir þart ile kontrolü saðlanýr.",
+ " Bir ana kontrol rölesi kendisinden sonra gelen ikinci bir ana kontrol",
+ " rölesine kadar devam eder. Diðer bir deyiþle birinci ana kontrol rölesi",
+ " baþlangýcý ikincisi ise bitiþi temsil eder. Ana kontrol rölesi kullandýktan",
+ " sonra iþlevini bitirmek için ikinci bir ana kontrol rölesi eklemelisiniz.",
+ "",
+ "> MOVE {destvar := } {Tret := }",
+ " -{ 123 MOV}- -{ srcvar MOV}-",
+ "",
+ " Giriþi 1 olduðunda verilen sabit sayýyý (123 gibi) yada verilen deðiþkenin",
+ " içeriðini (srcvar) belirtilen deðiþkene (destvar) atar. Giriþ 0 ise herhangi",
+ " bir iþlem olmaz. Bu komut ile zamanlayýcý ve sayýcýlar da dahil olmak üzere",
+ " tüm deðiþkenlere deðer atayabilirsiniz. Örneðin Tsay zamanlayýcýsýna MOVE ile",
+ " 0 atamak ile RES ile sýfýrlamak ayný sonucu doðurur. Bu komut bir satýrýn",
+ " saðýndaki en son komut olmalýdýr.",
+ "",
+ "> MATEMATÝK ÝÞLEMLER {ADD kay :=} {SUB Ccnt :=}",
+ " -{ 'a' + 10 }- -{ Ccnt - 10 }-",
+ "",
+ "> {MUL dest :=} {DIV dv := }",
+ " -{ var * -990 }- -{ dv / -10000}-",
+ "",
+ " Bu komutun giriþi doðru ise belirtilen hedef deðiþkenine verilen matematik",
+ " iþlemin sonucunu kaydeder. Ýþlenen bilgi zamanlayýcý ve sayýcýlar dahil",
+ " olmak üzere deðiþkenler yada sabit sayýlar olabilir. Ýþlenen bilgi 16 bit",
+ " iþaretli sayýdýr. Her çevrimde iþlemin yeniden yapýldýðý unutulmamalýdýr.",
+ " Örneðin artýrma yada eksiltme yapýyorsanýz yükselen yada düþen kenar",
+ " kullanmanýz gerekebilir. Bölme (DIV) virgülden sonrasýný keser. Örneðin;",
+ " 8 / 3 = 2 olur. Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ "",
+ "",
+ "> KARÞILAÞTIRMA [var ==] [var >] [1 >=]",
+ " -[ var2 ]- -[ 1 ]- -[ Ton]-",
+ "",
+ "> [var /=] [-4 < ] [1 <=]",
+ " -[ var2 ]- -[ vartwo]- -[ Cup]-",
+ "",
+ " Deðiþik karþýlaþtýrma komutlarý vardýr. Bu komutlarýn giriþi doðru (1)",
+ " ve verilen þart da doðru ise çýkýþlarý 1 olur.",
+ "",
+ "",
+ "> SAYICI Cname Cname",
+ " --[CTU >=5]-- --[CTD >=5]--",
+ "",
+ " Sayýcýlar giriþlerinin 0'dan 1'e her geçiþinde yani yükselen kenarýnda",
+ " deðerlerini 1 artýrýr (CTU) yada eksiltirler (CTD). Verilen þart doðru ise",
+ " çýkýþlarý aktif (1) olur. CTU ve CTD sayýcýlarýna ayný ismi erebilirsiniz.",
+ " Böylece ayný sayýcýyý artýrmýþ yada eksiltmiþ olursunuz. RES komutu sayýcýlarý",
+ " sýfýrlar. Sayýcýlar ile genel deðiþkenlerle kullandýðýnýz komutlarý kullanabilirsiniz.",
+ "",
+ "",
+ "> DAÝRESEL SAYICI Cname",
+ " --{CTC 0:7}--",
+ "",
+ " Normal yukarý sayýcýdan farký belirtilen limite ulaþýnca sayýcý tekrar 0'dan baþlar",
+ " Örneðin sayýcý 0, 1, 2, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 2,.... þeklinde",
+ " sayabilir. Yani bir dizi sayýcý olarak düþünülebilir. CTC sayýcýlar giriþlerinin",
+ " yükselen kenarýnda deðer deðiþtirirler. Bu komut bir satýrýn saðýndaki",
+ " en son komut olmalýdýr.",
+ " ",
+ "",
+ "> SHIFT REGISTER {SHIFT REG }",
+ " -{ reg0..3 }-",
+ "",
+ " Bir dizi deðiþken ile beraber çalýþýr. Ýsim olarak reg verdiðinizi ve aþama ",
+ " sayýsýný 3 olarak tanýmladýysanýz reg0, reg1, reg2 deðikenleri ile çalýþýrsýnýz.",
+ " Kaydedicinin giriþi reg0 olur. Giriþin her yükselen kenarýnda deðerler kaydedicide",
+ " bir saða kayar. Mesela; `reg2 := reg1'. and `reg1 := reg0'. `reg0' deðiþmez.",
+ " Geniþ bir kaydedici hafýzada çok yer kaplar.",
+ " Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ "",
+ "",
+ "> DEÐER TABLOSU {dest := }",
+ " -{ LUT[i] }-",
+ "",
+ " Deðer tablosu sýralanmýþ n adet deðer içeren bir tablodur. Giriþi doðru olduðunda",
+ " `dest' tamsayý deðiþkeni `i' tamsayý deðiþkenine karþýlýk gelen deðeri alýr. Sýra",
+ " 0'dan baþlar. bu nedenle `i' 0 ile (n-1) arasýnda olabilir. `i' bu deðerler ",
+ " arasýnda deðilse komutun ne yapacaðý tanýmlý deðildir.",
+ " Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ "",
+ "",
+ "> PIECEWISE LINEAR TABLE {yvar := }",
+ " -{ PWL[xvar] }-",
+ "",
+ " Bir matris tablo olarak düþünülebilir. Bir deðere baðlý olarak deðerin önceden",
+ " belirlenen bir baþka deðer ile deðiþtirilmesi içi oluþturulan bir tablodur.",
+ " Bu bir eðri oluþturmak, sensörden alýnan deðere göre çýkýþta baþka bir eðri",
+ " oluþturmak gibi amaçlar için kullanýlabilir.",
+ "",
+ " Farzedelimki x tamsayý giriþ deðerini y tamsayý çýkýþ deðerine yaklaþtýrmak ",
+ " istiyoruz. Deðerlerin belirli noktalarda olduðunu biliyoruz. Örneðin;",
+ "",
+ " f(0) = 2",
+ " f(5) = 10",
+ " f(10) = 50",
+ " f(100) = 100",
+ "",
+ " Bu þu noktalarýn eðride olduðunu gösterir:",
+ "",
+ " (x0, y0) = ( 0, 2)",
+ " (x1, y1) = ( 5, 10)",
+ " (x2, y2) = ( 10, 50)",
+ " (x3, y3) = (100, 100)",
+ "",
+ " Dört deðeri parçalý lineer tabloya gireriz. Komut, xvar'ýn deðerine bakarak",
+ " yvar'a deðer verir. Örneðin, yukarýdaki örneðe bakarak, xvar = 10 ise",
+ " yvar = 50 olur.",
+ " ",
+ " Tabloya kayýtlý iki deðerin arasýnda bir deðer verirseniz verilen deðer de",
+ " alýnmasý gereken iki deðerin arasýnda uygun gelen yerde bir deðer olur.",
+ " Mesela; xvar=55 yazarsanýz yvar=75 olur. (Tablodaki deðerler (10,50) ve",
+ " (100,100) olduðuna göre). 55, 10 ve 100 deðerlerinin ortasýndadýr. Bu",
+ " nedenle 55 ve 75 deðerlerinin ortasý olan 75 deðeri alýnýr.",
+ " ",
+ " Deðerler x koordinatýnda artan deðerler olarak yazýlmalýdýr. 16 bit tamsayý",
+ " kullanan bazý deðerler için arama tablosu üzerinde matematik iþlemler",
+ " gerçekleþmeyebilir. Bu durumda LDMicro sizi uyaracaktýr. Örneðin aþaðýdaki",
+ " tablo bir hata oluþturacaktýr:",
+ "",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (300, 300)",
+ "",
+ " Bu tip hatalarý noktalar arsýnda ara deðerler oluþturarak giderebilirsiniz.",
+ " Örneðin aþaðýdaki tablo yukarýdakinin aynýsý olmasýna raðmen hata ",
+ " oluþturmayacaktýr.",
+ " ",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (150, 150)",
+ " (x2, y2) = (300, 300)",
+ "",
+ " Genelde 5 yada 6 noktadan daha fazla deðer kullanmak gerekmeyecektir.",
+ " Daha fazla nokta demek daha fazla kod ve daha yavaþ çalýþma demektir.",
+ " En fazla 10 nokta oluþturabilirsiniz. xvar deðiþkenine x koordinatýnda",
+ " tablonun en yüksek deðerinden daha büyük bir deðer girmenin ve en düþük",
+ " deðerinden daha küçük bir deðer girmenin sonucu tanýmlý deðildir.",
+ " Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ "",
+ "> A/D ÇEVÝRÝCÝDEN OKUMA Aname",
+ " --{READ ADC}--",
+ "",
+ " LDmicro A/D çeviriciden deðer okumak için gerekli kodlarý desteklediði",
+ " iþlemciler için oluþturabilir. Komutun giriþi 1 olduðunda A/D çeviriciden ",
+ " deðer okunur ve okunan deðer `Aname' deðiþkenine aktarýlýr. Bu deðiþken",
+ " üzerinde genel deðiþkenlerle kullanýlabilen iþlemler kullanýlabilir.",
+ " (büyük, küçük, büyük yada eþit gibi). Bu deðiþkene iþlemcinin bacaklarýndan",
+ " uygun biri tanýmlanmalýdýr. Komutun giriþi 0 ise `Aname'deðiþkeninde bir",
+ " deðiþiklik olmaz.",
+ " ",
+ " Þu an desteklenen iþlemciler için; 0 Volt için ADC'den okunan deðer 0, ",
+ " Vdd (besleme gerilimi) deðerine eþit gerilim deðeri için ADC'den okunan deðer",
+ " 1023 olmaktadýr. AVR kullanýyorsanýz AREF ucunu Vdd besleme gerilimine ",
+ " baðlayýnýz.",
+ " ",
+ " Aritmetik iþlemler ADC deðiþkeni için kullanýlabilir. Ayrýca bacak tanýmlarken",
+ " ADC olmayan bacaklarýn tanýmlanmasýný LDMicro engelleyecektir.",
+ " Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ "",
+ " > PWM PALS GENÝÞLÝÐÝ AYARI duty_cycle",
+ " -{PWM 32.8 kHz}-",
+ "",
+ " LDmicro desteklediði mikrokontrolörler için gerekli PWM kodlarýný üretebilir.",
+ " Bu komutun giriþi doðru (1) olduðunda PWM sinyalinin pals geniþliði duty_cycle",
+ " deðiþkeninin deðerine ayarlanýr. Bu deðer 0 ile 100 arasýnda deðiþir. Pals",
+ " geniþliði yüzde olarak ayarlanýr. Bir periyot 100 birim kabul edilirse bu",
+ " geniþliðin yüzde kaçýnýn palsi oluþturacaðý ayarlanýr. 0 periyodun tümü sýfýr",
+ " 100 ise periyodun tamamý 1 olsun anlamýna gelir. 10 deðeri palsin %10'u 1 geri",
+ " kalan %90'ý sýfýr olsun anlamýna gelir.",
+ "",
+ " PWM frekansýný ayarlayabilirsiniz. Verilen deðer Hz olarak verilir.",
+ " Verdiðiniz frekans kesinlikle ayarlanabilir olmalýdýr. LDMicro verdiðiniz deðeri",
+ " olabilecek en yakýn deðerle deðiþtirir. Yüksek hýzlarda doðruluk azalýr.",
+ " ",
+ " Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ " Periyodun süresinin ölçülebilmesi için iþlemcinin zamanlayýcýlarýnýn bir tanesi",
+ " kullanýlýr. Bu nedenle PWM en az iki tane zamanlayýcýsý olan iþlemcilerde kullanýlýr.",
+ " PWM PIC16 iþlemcilerde CCP2'yi, AVR'lerde ise OC2'yi kullanýr.",
+ "",
+ "",
+ "> EEPROMDA SAKLA saved_var",
+ " --{PERSIST}--",
+ "",
+ " Bu komut ile belirtilen deðiþkenin EEPROM'da saklanmasý gereken bir deðiþken olduðunu",
+ " belirmiþ olursunuz. Komutun giriþi doðru ise belirtilen deðiþkenin içeriði EEPROM'a",
+ " kaydedilir. Enerji kesildiðinde kaybolmamasý istenen deðerler için bu komut kullanýlýr.",
+ " Deðiþkenin içeriði gerilim geldiðinde tekrar EEPROM'dan yüklenir. Ayrýca;",
+ " deðiþkenin içeriði her deðiþtiðinde yeni deðer tekrar EEPROM'a kaydedilir.",
+ " Ayrýca bir iþlem yapýlmasý gerekmez.",
+ " Bu komut bir satýrýn saðýndaki en son komut olmalýdýr.",
+ "",
+ "************************",
+ "> UART (SERÝ BÝLGÝ) AL var",
+ " --{UART RECV}--",
+ "",
+ " LDmicro belirli iþlemciler için gerekli UART kodlarýný üretebilir. AVR iþlemcilerde",
+ " sadece UART1 (UART0) deðil) desteklenmektedir. Ýletiþim hýzý (baudrate) ayarlarýný ",
+ " Ayarlar->Ýþlemci Ayarlarý menüsünden yapmalýsýnýz. Hýz kristal frekansýna baðlý olup,",
+ " bazý hýzlar desteklenmeyebilir. Bu durumda LDMicro sizi uyaracaktýr. ",
+ " ",
+ " Bu komutun giriþi yanlýþsa herhangi bir iþlem yapýlmaz. Doðru ise UART'dan 1 karakter",
+ " alýnmaya çalýþýlýr. Okuma yapýlamaz ise komutun çýkýþý yanlýþ (0) olur. Karakter",
+ " okunursa okunan karakter `var' deðiþkeninde saklanýr ve komutun çýkýþý doðru (1) olur.",
+ " Çýkýþýn doðru olmasý sadece bir PLC çevrimi sürer.",
+ "",
+ "",
+ "> UART (SERÝ BÝLGÝ) GÖNDER var",
+ " --{UART SEND}--",
+ "",
+ " LDmicro belirli iþlemciler için gerekli UART kodlarýný üretebilir. AVR iþlemcilerde",
+ " sadece UART1 (UART0) deðil) desteklenmektedir. Ýletiþim hýzý (baudrate) ayarlarýný ",
+ " Ayarlar->Ýþlemci Ayarlarý menüsünden yapmalýsýnýz. Hýz kristal frekansýna baðlý olup,",
+ " bazý hýzlar desteklenmeyebilir. Bu durumda LDMicro sizi uyaracaktýr.",
+ " ",
+ " Bu komutun giriþi yanlýþsa herhangi bir iþlem yapýlmaz. Doðru ise UART'dan 1 karakter",
+ " gönderilir. Gönderilecek karakter gönderme iþleminden önce `var' deðiþkeninde saklý",
+ " olmalýdýr. Komutun çýkýþý UART meþgulse (bir karakterin gönderildiði sürece)",
+ " doðru (1) olur. Aksi halde yanlýþ olur.",
+ " Çýkýþýn doðru olmasý sadece bir PLC çevrimi sürer.",
+ " ",
+ " Karakterin gönderilmesi belirli bir zaman alýr. Bu nedenle baþka bir karakter",
+ " göndermeden önce önceki karakterin gönderildiðini kontrol ediniz veya gönderme",
+ " iþlemlerinin arasýna geikme ekleyiniz. Komutun giriþini sadece çýkýþ yanlýþ",
+ " (UART meþgul deðilse)ise doðru yapýnýz.",
+ "",
+ " Bu komut yerine biçimlendirilmiþ kelime komutunu (bir sonraki komut) inceleyiniz.",
+ " Biçimlendirilmiþ kelime komutunun kullanýmý daha kolaydýr. Ýstediðiniz iþlemleri",
+ " daha rahat gerçekleþtirebilirsiniz.",
+ "",
+ "",
+ "> UART ÜZERÝNDEN BÝÇÝMLENDÝRÝLMÝÞ KELÝME var",
+ " -{\"Pressure: \\3\\r\\n\"}-",
+ "",
+ " LDmicro belirli iþlemciler için gerekli UART kodlarýný üretebilir. AVR iþlemcilerde",
+ " sadece UART1 (UART0) deðil) desteklenmektedir. Ýletiþim hýzý (baudrate) ayarlarýný ",
+ " Ayarlar->Ýþlemci Ayarlarý menüsünden yapmalýsýnýz. Hýz kristal frekansýna baðlý olup,",
+ " bazý hýzlar desteklenmeyebilir. Bu durumda LDMicro sizi uyaracaktýr.",
+ "",
+ " Bu komutun giriþi yanlýþtan doðruya geçerse (yükselen kenar) ise seri port üzerinden",
+ " tüm kelimeyi gönderir. Eðer kelime `\\3' özel kodunu içeriyorsa dizi içeriði ",
+ " `var' deðiþkenin içeriði otomatik olarak kelimeye (string) çevrilerek`var'",
+ " deðiþkeninin içeriði ile deðiþtirilir. Deðiþkenin uzunluðu 3 karakter olacak þekilde",
+ " deðiþtirilir. Mesela; `var' deðiþkeninin içeriði 35 ise kelime 35 rakamýnýn baþýna bir",
+ " adet boþul eklenerek `Pressure: 35\\r\\n' haline getirilir. Veya `var'deðiþkeninin",
+ " içeriði 1453 ise yapýlacak iþlem belli olmaz. Bu durumda `\\4' kullanmak gerekebilir.",
+ "",
+ " Deðiþken negatif bir sayý olabilecekse `\\-3d' (veya `\\-4d') gibi uygun bir deðer",
+ " kullanmalýsýnýz. Bu durumda LDMicro negatif sayýlarýn önüne eksi iþareti, pozitif sayýlarýn",
+ " önüne ise bir boþluk karakteri yerleþtirecektir.",
+ "",
+ " Ayný anda birkaç iþlem tanýmlanýrsa, yada UART ile ilgili iþlemler birbirine",
+ " karýþýk hale getirilirse programýn davranýþý belirli olmayacaktýr. Bu nedenle",
+ " dikkatli olmalýsýnýz.",
+ "",
+ " Kullanýlabilecek özel karakterler (escape kodlarý) þunlardýr:",
+ " * \\r -- satýr baþýna geç",
+ " * \\n -- yeni satýr",
+ " * \\f -- kaðýdý ilerlet (formfeed)",
+ " * \\b -- bir karakter geri gel (backspace)",
+ " * \\xAB -- ASCII karakter kodu 0xAB (hex)",
+ "",
+ " Bu komutun çýkýþý bilgi gönderiyorken doðru diðer durumlarda yanlýþ olur.",
+ " Bu komut program hafýzasýnda çok yer kaplar.",
+ "",
+ "",
+ "MATEMATÝKSEL ÝÞLEMLER ÝLE ÝLGÝLÝ BÝLGÝ",
+ "======================================",
+ "",
+ "Unutmayýn ki, LDMicro 16-bit tamsayý matematik komutlarýna sahiptir.",
+ "Bu iþlemlerde kullanýlan deðerler ve hesaplamanýn sonucu -32768 ile",
+ "32767 arasýnda bir tamsayý olabilir.",
+ "",
+ "Mesela y = (1/x)*1200 formülünü hesaplamaya çalýþalým. x 1 ile 20",
+ "arasýnda bir sayýdýr. Bu durumda y 1200 ile 60 arasýnda olur. Bu sayý",
+ "16-bit bir tamsayý sýnýrlarý içindedir. Ladder diyagramýmýzý yazalým.",
+ "Önce bölelim, sonra çarpma iþlemini yapalým:",
+ "",
+ " || {DIV temp :=} ||",
+ " ||---------{ 1 / x }----------||",
+ " || ||",
+ " || {MUL y := } ||",
+ " ||----------{ temp * 1200}----------||",
+ " || ||",
+ "",
+ "Yada bölmeyi doðrudan yapalým:",
+ "",
+ " || {DIV y :=} ||",
+ " ||-----------{ 1200 / x }-----------||",
+ "",
+ "Matematiksel olarak iki iþlem aynýd sonucu vermelidir. Ama birinci iþlem",
+ "yanlýþ sonuç verecektir. (y=0 olur). Bu hata `temp' deðiþkeninin 1'den",
+ "küçük sonuç vermesindendir.Mesela x = 3 iken (1 / x) = 0.333 olur. Ama",
+ "0.333 bir tamsayý deðildir. Bu nedenle sonuç 0 olur. Ýkinci adýmda ise",
+ "y = temp * 1200 = 0 olur. Ýkinci þekilde ise bölen bir tamsayý olduðundan",
+ "sonuç doðru çýkacaktýr.",
+ "",
+ "Ýþlemlerinizde bir sorun varsa dikkatle kontrol ediniz. Ayrýca sonucun",
+ "baþa dönmemesine de dikkat ediniz. Mesela 32767 + 1 = -32768 olur.",
+ "32767 sýnýrý aþýlmýþ olacaktýr. ",
+ "",
+ "Hesaplamalarýnýzda mantýksal deðiþimler yaparak doðru sonuçlar elde edebilirsiniz.",
+ "Örneðin; y = 1.8*x ise formülünüzü y = (9/5)*x þeklinde yazýnýz.(1.8 = 9/5)",
+ "y = (9*x)/5 þeklindeki bir kod sonucu daha tutarlý hale getirecektir.",
+ "performing the multiplication first:",
+ "",
+ " || {MUL temp :=} ||",
+ " ||---------{ x * 9 }----------||",
+ " || ||",
+ " || {DIV y :=} ||",
+ " ||-----------{ temp / 5 }-----------||",
+ "",
+ "",
+ "KODALAMA ÞEKLÝ",
+ "==============",
+ "",
+ "Programýn saðladýðý kolaylýklardan faydalanýn. Mesela:",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || Xb Yb ||",
+ " ||-------] [------+-------( )-------||",
+ " || | ||",
+ " || | Yc ||",
+ " || +-------( )-------||",
+ " || ||",
+ "",
+ "yazmak aþaðýdakinden daha kolay olacaktýr.",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yb ||",
+ " 2 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yc ||",
+ " 3 ||-------] [--------------( )-------||",
+ " || ||",
+ "",
+ " * * *",
+ "",
+ "Yazdýðýnýz kodlarýn sonuçlarýna dikkat ediniz. Aþaðýdaki satýrlarda",
+ "mantýksýz bir programlama yapýlmýþtýr. Çünkü hem Xa hemde Xb ayný",
+ "anda doðru olabilir.",
+ "",
+ " || Xa {v := } ||",
+ " 1 ||-------] [--------{ 12 MOV}--||",
+ " || ||",
+ " || Xb {v := } ||",
+ " ||-------] [--------{ 23 MOV}--||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || [v >] Yc ||",
+ " 2 ||------[ 15]-------------( )-------||",
+ " || ||",
+ "",
+ "Aþaðýdaki satýrlar yukarda bahsi geçen tarzdadýr. Ancak yapýlan",
+ "iþlem 4-bit binary sayý tamsayýya çevrilmektedir.",
+ "",
+ " || {v := } ||",
+ " 3 ||-----------------------------------{ 0 MOV}--||",
+ " || ||",
+ " || Xb0 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 1 }-----------||",
+ " || ||",
+ " || Xb1 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 2 }-----------||",
+ " || ||",
+ " || Xb2 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 4 }-----------||",
+ " || ||",
+ " || Xb3 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 8 }-----------||",
+ " || ||",
+ "",
+ "",
+ "HATALAR (BUG)",
+ "=============",
+ "",
+ "LDmicro tarafýndan üretilen kodlar çok verimli kodlar deðildir. Yavaþ çalýþan",
+ "ve hafýzada fazla yer kaplayan kodlar olabilirler. Buna raðmen orta büyüklükte",
+ "bir PIC veya AVR küçük bir PLC'nin yaptýðý iþi yapar. Bu nedenle diðer sorunlar",
+ "yer yer gözardý edlebilir.",
+ "",
+ "Deðiþken isimleri çok uzun olmamalýdýr. ",
+ "",
+ "Programýnýz yada kullandýðýnýz hafýza seçtiðiniz iþlemcinin sahip olduðundan",
+ "büyükse LDMicro hata vermeyebilir. Dikkat etmezseniz programýnýz hatalý çalýþacaktýr.",
+ "",
+ "Bulduðunuz hatalarý yazara bildiriniz.",
+ "",
+ "Teþekkürler:",
+ " * Marcelo Solano, Windows 98'deki UI problemini bildirdiði için,",
+ " * Serge V. Polubarjev, PIC16F628 iþlemcisi seçildiðinde RA3:0'ýn çalýþmadýðý",
+ " ve nasýl düzelteceðimi bildirdiði için,",
+ " * Maxim Ibragimov, ATmega16 ve ATmega162 iþlemcileri test ettikleri, problemleri",
+ " bulduklarý ve bildirdikleri için,",
+ " * Bill Kishonti, sýfýra bölüm hatasý olduðunda simülasyonun çöktüðünü bildirdikleri",
+ " için,",
+ " * Mohamed Tayae, PIC16F628 iþlemcisinde EEPROM'da saklanmasý gereken deðiþkenlerin",
+ " aslýnda saklanmadýðýný bildirdiði için,",
+ " * David Rothwell, kullanýcý arayüzündeki birkaç problemi ve \"Metin Dosyasý Olarak Kaydet\"",
+ " fonksiyonundaki problemi bildirdiði için.",
+ "",
+ "",
+ "KOPYALAMA VE KULLANIM ÞARTLARI",
+ "==============================",
+ "",
+ "LDMICRO TARAFINDAN ÜRETÝLEN KODU ÝNSAN HAYATI VE ÝNSAN HAYATINI ETKÝLEYEBÝLECEK",
+ "PROJELERDE KULLANMAYINIZ. LDMICRO PROGRAMCISI LDMICRO'NUN KENDÝNDEN VE LDMICRO",
+ "ÝLE ÜRETÝLEN KODDAN KAYNAKLANAN HÝÇBÝR PROBLEM ÝÇÝN SORUMLULUK KABUL ETMEMEKTEDÝR.",
+ "",
+ "Bu program ücretsiz bir program olup, dilediðiniz gibi daðýtabilirsiniz,",
+ "kaynak kodda deðiþiklik yapabilirsiniz. Programýn kullanýmý Free Software Foundation",
+ "tarafýndan yazýlan GNU General Public License (version 3 ve sonrasý)þartlarýna baðlýdýr.",
+ "",
+ "Program faydalý olmasý ümidiyle daðýtýlmýþtýr. Ancak hiçbir garanti verilmemektedir.",
+ "Detaylar için GNU General Public License içeriðine bakýnýz.",
+ "",
+ "Söz konusu sözleþmenin bir kopyasý bu programla beraber gelmiþ olmasý gerekmektedir.",
+ "Gelmediyse <http://www.gnu.org/licenses/> adresinde bulabilirsiniz.",
+ "",
+ "",
+ "Jonathan Westhues",
+ "",
+ "Rijswijk -- Dec 2004",
+ "Waterloo ON -- Jun, Jul 2005",
+ "Cambridge MA -- Sep, Dec 2005",
+ " Feb, Mar 2006",
+ " Feb 2007",
+ "",
+ "Email: user jwesthues, at host cq.cx",
+ "",
+ "Türkçe Versiyon : <http://tekelektirik.com/public/ldmicro.rar>",
+ NULL
+};
+#endif
+
+#if defined(LDLANG_EN) || defined(LDLANG_ES) || defined(LDLANG_IT) || defined(LDLANG_PT)
+char *HelpText[] = {
+ "",
+ "INTRODUCTION",
+ "============",
+ "",
+ "LDmicro generates native code for certain Microchip PIC16 and Atmel AVR",
+ "microcontrollers. Usually software for these microcontrollers is written",
+ "in a programming language like assembler, C, or BASIC. A program in one",
+ "of these languages comprises a list of statements. These languages are",
+ "powerful and well-suited to the architecture of the processor, which",
+ "internally executes a list of instructions.",
+ "",
+ "PLCs, on the other hand, are often programmed in `ladder logic.' A simple",
+ "program might look like this:",
+ "",
+ " || ||",
+ " || Xbutton1 Tdon Rchatter Yred ||",
+ " 1 ||-------]/[---------[TON 1.000 s]-+-------]/[--------------( )-------||",
+ " || | ||",
+ " || Xbutton2 Tdof | ||",
+ " ||-------]/[---------[TOF 2.000 s]-+ ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Rchatter Ton Tnew Rchatter ||",
+ " 2 ||-------]/[---------[TON 1.000 s]----[TOF 1.000 s]---------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " ||------[END]---------------------------------------------------------||",
+ " || ||",
+ " || ||",
+ "",
+ "(TON is a turn-on delay; TOF is a turn-off delay. The --] [-- statements",
+ "are inputs, which behave sort of like the contacts on a relay. The",
+ "--( )-- statements are outputs, which behave sort of like the coil of a",
+ "relay. Many good references for ladder logic are available on the Internet",
+ "and elsewhere; details specific to this implementation are given below.)",
+ "",
+ "A number of differences are apparent:",
+ "",
+ " * The program is presented in graphical format, not as a textual list",
+ " of statements. Many people will initially find this easier to",
+ " understand.",
+ "",
+ " * At the most basic level, programs look like circuit diagrams, with",
+ " relay contacts (inputs) and coils (outputs). This is intuitive to",
+ " programmers with knowledge of electric circuit theory.",
+ "",
+ " * The ladder logic compiler takes care of what gets calculated",
+ " where. You do not have to write code to determine when the outputs",
+ " have to get recalculated based on a change in the inputs or a",
+ " timer event, and you do not have to specify the order in which",
+ " these calculations must take place; the PLC tools do that for you.",
+ "",
+ "LDmicro compiles ladder logic to PIC16 or AVR code. The following",
+ "processors are supported:",
+ " * PIC16F877",
+ " * PIC16F628",
+ " * PIC16F876 (untested)",
+ " * PIC16F88 (untested)",
+ " * PIC16F819 (untested)",
+ " * PIC16F887 (untested)",
+ " * PIC16F886 (untested)",
+ " * ATmega128",
+ " * ATmega64",
+ " * ATmega162 (untested)",
+ " * ATmega32 (untested)",
+ " * ATmega16 (untested)",
+ " * ATmega8 (untested)",
+ "",
+ "It would be easy to support more AVR or PIC16 chips, but I do not have",
+ "any way to test them. If you need one in particular then contact me and",
+ "I will see what I can do.",
+ "",
+ "Using LDmicro, you can draw a ladder diagram for your program. You can",
+ "simulate the logic in real time on your PC. Then when you are convinced",
+ "that it is correct you can assign pins on the microcontroller to the",
+ "program inputs and outputs. Once you have assigned the pins, you can",
+ "compile PIC or AVR code for your program. The compiler output is a .hex",
+ "file that you can program into your microcontroller using any PIC/AVR",
+ "programmer.",
+ "",
+ "LDmicro is designed to be somewhat similar to most commercial PLC",
+ "programming systems. There are some exceptions, and a lot of things",
+ "aren't standard in industry anyways. Carefully read the description",
+ "of each instruction, even if it looks familiar. This document assumes",
+ "basic knowledge of ladder logic and of the structure of PLC software",
+ "(the execution cycle: read inputs, compute, write outputs).",
+ "",
+ "",
+ "ADDITIONAL TARGETS",
+ "==================",
+ "",
+ "It is also possible to generate ANSI C code. You could use this with any",
+ "processor for which you have a C compiler, but you are responsible for",
+ "supplying the runtime. That means that LDmicro just generates source",
+ "for a function PlcCycle(). You are responsible for calling PlcCycle",
+ "every cycle time, and you are responsible for implementing all the I/O",
+ "(read/write digital input, etc.) functions that the PlcCycle() calls. See",
+ "the comments in the generated source for more details.",
+ "",
+ "Finally, LDmicro can generate processor-independent bytecode for a",
+ "virtual machine designed to run ladder logic code. I have provided a",
+ "sample implementation of the interpreter/VM, written in fairly portable",
+ "C. This target will work for just about any platform, as long as you",
+ "can supply your own VM. This might be useful for applications where you",
+ "wish to use ladder logic as a `scripting language' to customize a larger",
+ "program. See the comments in the sample interpreter for details.",
+ "",
+ "",
+ "COMMAND LINE OPTIONS",
+ "====================",
+ "",
+ "ldmicro.exe is typically run with no command line options. That means",
+ "that you can just make a shortcut to the program, or save it to your",
+ "desktop and double-click the icon when you want to run it, and then you",
+ "can do everything from within the GUI.",
+ "",
+ "If LDmicro is passed a single filename on the command line",
+ "(e.g. `ldmicro.exe asd.ld'), then LDmicro will try to open `asd.ld',",
+ "if it exists. An error is produced if `asd.ld' does not exist. This",
+ "means that you can associate ldmicro.exe with .ld files, so that it runs",
+ "automatically when you double-click a .ld file.",
+ "",
+ "If LDmicro is passed command line arguments in the form",
+ "`ldmicro.exe /c src.ld dest.hex', then it tries to compile `src.ld',",
+ "and save the output as `dest.hex'. LDmicro exits after compiling,",
+ "whether the compile was successful or not. Any messages are printed",
+ "to the console. This mode is useful only when running LDmicro from the",
+ "command line.",
+ "",
+ "",
+ "BASICS",
+ "======",
+ "",
+ "If you run LDmicro with no arguments then it starts with an empty",
+ "program. If you run LDmicro with the name of a ladder program (xxx.ld)",
+ "on the command line then it will try to load that program at startup.",
+ "LDmicro uses its own internal format for the program; it cannot import",
+ "logic from any other tool.",
+ "",
+ "If you did not load an existing program then you will be given a program",
+ "with one empty rung. You could add an instruction to it; for example",
+ "you could add a set of contacts (Instruction -> Insert Contacts) named",
+ "`Xnew'. `X' means that the contacts will be tied to an input pin on the",
+ "microcontroller. You could assign a pin to it later, after choosing a",
+ "microcontroller and renaming the contacts. The first letter of a name",
+ "indicates what kind of object it is. For example:",
+ "",
+ " * Xname -- tied to an input pin on the microcontroller",
+ " * Yname -- tied to an output pin on the microcontroller",
+ " * Rname -- `internal relay': a bit in memory",
+ " * Tname -- a timer; turn-on delay, turn-off delay, or retentive",
+ " * Cname -- a counter, either count-up or count-down",
+ " * Aname -- an integer read from an A/D converter",
+ " * name -- a general-purpose (integer) variable",
+ "",
+ "Choose the rest of the name so that it describes what the object does,",
+ "and so that it is unique within the program. The same name always refers",
+ "to the same object within the program. For example, it would be an error",
+ "to have a turn-on delay (TON) called `Tdelay' and a turn-off delay (TOF)",
+ "called `Tdelay' in the same program, since each counter needs its own",
+ "memory. On the other hand, it would be correct to have a retentive timer",
+ "(RTO) called `Tdelay' and a reset instruction (RES) associated with",
+ "`Tdelay', since it that case you want both instructions to work with",
+ "the same timer.",
+ "",
+ "Variable names can consist of letters, numbers, and underscores",
+ "(_). A variable name must not start with a number. Variable names are",
+ "case-sensitive.",
+ "",
+ "The general variable instructions (MOV, ADD, EQU, etc.) can work on",
+ "variables with any name. This means that they can access timer and",
+ "counter accumulators. This may sometimes be useful; for example, you",
+ "could check if the count of a timer is in a particular range.",
+ "",
+ "Variables are always 16 bit integers. This means that they can go",
+ "from -32768 to 32767. Variables are always treated as signed. You can",
+ "specify literals as normal decimal numbers (0, 1234, -56). You can also",
+ "specify ASCII character values ('A', 'z') by putting the character in",
+ "single-quotes. You can use an ASCII character code in most places that",
+ "you could use a decimal number.",
+ "",
+ "At the bottom of the screen you will see a list of all the objects in",
+ "the program. This list is automatically generated from the program;",
+ "there is no need to keep it up to date by hand. Most objects do not",
+ "need any configuration. `Xname', `Yname', and `Aname' objects must be",
+ "assigned to a pin on the microcontroller, however. First choose which",
+ "microcontroller you are using (Settings -> Microcontroller). Then assign",
+ "your I/O pins by double-clicking them on the list.",
+ "",
+ "You can modify the program by inserting or deleting instructions. The",
+ "cursor in the program display blinks to indicate the currently selected",
+ "instruction and the current insertion point. If it is not blinking then",
+ "press <Tab> or click on an instruction. Now you can delete the current",
+ "instruction, or you can insert a new instruction to the right or left",
+ "(in series with) or above or below (in parallel with) the selected",
+ "instruction. Some operations are not allowed. For example, no instructions",
+ "are allowed to the right of a coil.",
+ "",
+ "The program starts with just one rung. You can add more rungs by selecting",
+ "Insert Rung Before/After in the Logic menu. You could get the same effect",
+ "by placing many complicated subcircuits in parallel within one rung,",
+ "but it is more clear to use multiple rungs.",
+ "",
+ "Once you have written a program, you can test it in simulation, and then",
+ "you can compile it to a HEX file for the target microcontroller.",
+ "",
+ "",
+ "SIMULATION",
+ "==========",
+ "",
+ "To enter simulation mode, choose Simulate -> Simulation Mode or press",
+ "<Ctrl+M>. The program is shown differently in simulation mode. There is",
+ "no longer a cursor. The instructions that are energized show up bright",
+ "red; the instructions that are not appear greyed. Press the space bar to",
+ "run the PLC one cycle. To cycle continuously in real time, choose",
+ "Simulate -> Start Real-Time Simulation, or press <Ctrl+R>. The display of",
+ "the program will be updated in real time as the program state changes.",
+ "",
+ "You can set the state of the inputs to the program by double-clicking",
+ "them in the list at the bottom of the screen, or by double-clicking an",
+ "`Xname' contacts instruction in the program. If you change the state of",
+ "an input pin then that change will not be reflected in how the program",
+ "is displayed until the PLC cycles; this will happen automatically if",
+ "you are running a real time simulation, or when you press the space bar.",
+ "",
+ "",
+ "COMPILING TO NATIVE CODE",
+ "========================",
+ "",
+ "Ultimately the point is to generate a .hex file that you can program",
+ "into your microcontroller. First you must select the part number of the",
+ "microcontroller, under the Settings -> Microcontroller menu. Then you",
+ "must assign an I/O pin to each `Xname' or `Yname' object. Do this by",
+ "double-clicking the object name in the list at the bottom of the screen.",
+ "A dialog will pop up where you can choose an unallocated pin from a list.",
+ "",
+ "Then you must choose the cycle time that you will run with, and you must",
+ "tell the compiler what clock speed the micro will be running at. These",
+ "are set under the Settings -> MCU Parameters... menu. In general you",
+ "should not need to change the cycle time; 10 ms is a good value for most",
+ "applications. Type in the frequency of the crystal that you will use",
+ "with the microcontroller (or the ceramic resonator, etc.) and click okay.",
+ "",
+ "Now you can generate code from your program. Choose Compile -> Compile,",
+ "or Compile -> Compile As... if you have previously compiled this program",
+ "and you want to specify a different output file name. If there are no",
+ "errors then LDmicro will generate an Intel IHEX file ready for",
+ "programming into your chip.",
+ "",
+ "Use whatever programming software and hardware you have to load the hex",
+ "file into the microcontroller. Remember to set the configuration bits",
+ "(fuses)! For PIC16 processors, the configuration bits are included in the",
+ "hex file, and most programming software will look there automatically.",
+ "For AVR processors you must set the configuration bits by hand.",
+ "",
+ "",
+ "INSTRUCTIONS REFERENCE",
+ "======================",
+ "",
+ "> CONTACT, NORMALLY OPEN Xname Rname Yname",
+ " ----] [---- ----] [---- ----] [----",
+ "",
+ " If the signal going into the instruction is false, then the output",
+ " signal is false. If the signal going into the instruction is true,",
+ " then the output signal is true if and only if the given input pin,",
+ " output pin, or internal relay is true, else it is false. This",
+ " instruction can examine the state of an input pin, an output pin,",
+ " or an internal relay.",
+ "",
+ "",
+ "> CONTACT, NORMALLY CLOSED Xname Rname Yname",
+ " ----]/[---- ----]/[---- ----]/[----",
+ "",
+ " If the signal going into the instruction is false, then the output",
+ " signal is false. If the signal going into the instruction is true,",
+ " then the output signal is true if and only if the given input pin,",
+ " output pin, or internal relay is false, else it is false. This",
+ " instruction can examine the state of an input pin, an output pin,",
+ " or an internal relay. This is the opposite of a normally open contact.",
+ "",
+ "",
+ "> COIL, NORMAL Rname Yname",
+ " ----( )---- ----( )----",
+ "",
+ " If the signal going into the instruction is false, then the given",
+ " internal relay or output pin is cleared false. If the signal going",
+ " into this instruction is true, then the given internal relay or output",
+ " pin is set true. It is not meaningful to assign an input variable to a",
+ " coil. This instruction must be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> COIL, NEGATED Rname Yname",
+ " ----(/)---- ----(/)----",
+ "",
+ " If the signal going into the instruction is true, then the given",
+ " internal relay or output pin is cleared false. If the signal going",
+ " into this instruction is false, then the given internal relay or",
+ " output pin is set true. It is not meaningful to assign an input",
+ " variable to a coil. This is the opposite of a normal coil. This",
+ " instruction must be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> COIL, SET-ONLY Rname Yname",
+ " ----(S)---- ----(S)----",
+ "",
+ " If the signal going into the instruction is true, then the given",
+ " internal relay or output pin is set true. Otherwise the internal",
+ " relay or output pin state is not changed. This instruction can only",
+ " change the state of a coil from false to true, so it is typically",
+ " used in combination with a reset-only coil. This instruction must",
+ " be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> COIL, RESET-ONLY Rname Yname",
+ " ----(R)---- ----(R)----",
+ "",
+ " If the signal going into the instruction is true, then the given",
+ " internal relay or output pin is cleared false. Otherwise the",
+ " internal relay or output pin state is not changed. This instruction",
+ " instruction can only change the state of a coil from true to false,",
+ " so it is typically used in combination with a set-only coil. This",
+ " instruction must be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> TURN-ON DELAY Tdon ",
+ " -[TON 1.000 s]-",
+ "",
+ " When the signal going into the instruction goes from false to true,",
+ " the output signal stays false for 1.000 s before going true. When the",
+ " signal going into the instruction goes from true to false, the output",
+ " signal goes false immediately. The timer is reset every time the input",
+ " goes false; the input must stay true for 1000 consecutive milliseconds",
+ " before the output will go true. The delay is configurable.",
+ "",
+ " The `Tname' variable counts up from zero in units of scan times. The",
+ " TON instruction outputs true when the counter variable is greater",
+ " than or equal to the given delay. It is possible to manipulate the",
+ " counter variable elsewhere, for example with a MOV instruction.",
+ "",
+ "",
+ "> TURN-OFF DELAY Tdoff ",
+ " -[TOF 1.000 s]-",
+ "",
+ " When the signal going into the instruction goes from true to false,",
+ " the output signal stays true for 1.000 s before going false. When",
+ " the signal going into the instruction goes from false to true,",
+ " the output signal goes true immediately. The timer is reset every",
+ " time the input goes false; the input must stay false for 1000",
+ " consecutive milliseconds before the output will go false. The delay",
+ " is configurable.",
+ "",
+ " The `Tname' variable counts up from zero in units of scan times. The",
+ " TON instruction outputs true when the counter variable is greater",
+ " than or equal to the given delay. It is possible to manipulate the",
+ " counter variable elsewhere, for example with a MOV instruction.",
+ "",
+ "",
+ "> RETENTIVE TIMER Trto ",
+ " -[RTO 1.000 s]-",
+ "",
+ " This instruction keeps track of how long its input has been true. If",
+ " its input has been true for at least 1.000 s, then the output is",
+ " true. Otherwise the output is false. The input need not have been",
+ " true for 1000 consecutive milliseconds; if the input goes true",
+ " for 0.6 s, then false for 2.0 s, and then true for 0.4 s, then the",
+ " output will go true. After the output goes true it will stay true",
+ " even after the input goes false, as long as the input has been true",
+ " for longer than 1.000 s. This timer must therefore be reset manually,",
+ " using the reset instruction.",
+ "",
+ " The `Tname' variable counts up from zero in units of scan times. The",
+ " TON instruction outputs true when the counter variable is greater",
+ " than or equal to the given delay. It is possible to manipulate the",
+ " counter variable elsewhere, for example with a MOV instruction.",
+ "",
+ "",
+ "> RESET Trto Citems",
+ " ----{RES}---- ----{RES}----",
+ "",
+ " This instruction resets a timer or a counter. TON and TOF timers are",
+ " automatically reset when their input goes false or true, so RES is",
+ " not required for these timers. RTO timers and CTU/CTD counters are",
+ " not reset automatically, so they must be reset by hand using a RES",
+ " instruction. When the input is true, the counter or timer is reset;",
+ " when the input is false, no action is taken. This instruction must",
+ " be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> ONE-SHOT RISING _",
+ " --[OSR_/ ]--",
+ "",
+ " This instruction normally outputs false. If the instruction's input",
+ " is true during this scan and it was false during the previous scan",
+ " then the output is true. It therefore generates a pulse one scan",
+ " wide on each rising edge of its input signal. This instruction is",
+ " useful if you want to trigger events off the rising edge of a signal.",
+ "",
+ "",
+ "> ONE-SHOT FALLING _",
+ " --[OSF \\_]--",
+ "",
+ " This instruction normally outputs false. If the instruction's input",
+ " is false during this scan and it was true during the previous scan",
+ " then the output is true. It therefore generates a pulse one scan",
+ " wide on each falling edge of its input signal. This instruction is",
+ " useful if you want to trigger events off the falling edge of a signal.",
+ "",
+ "",
+ "> SHORT CIRCUIT, OPEN CIRCUIT",
+ " ----+----+---- ----+ +----",
+ "",
+ " The output condition of a short-circuit is always equal to its",
+ " input condition. The output condition of an open-circuit is always",
+ " false. These are mostly useful for debugging.",
+ "",
+ "",
+ "> MASTER CONTROL RELAY",
+ " -{MASTER RLY}-",
+ "",
+ " By default, the rung-in condition of every rung is true. If a master",
+ " control relay instruction is executed with a rung-in condition of",
+ " false, then the rung-in condition for all following rungs becomes",
+ " false. This will continue until the next master control relay",
+ " instruction is reached (regardless of the rung-in condition of that",
+ " instruction). These instructions must therefore be used in pairs:",
+ " one to (maybe conditionally) start the possibly-disabled section,",
+ " and one to end it.",
+ "",
+ "",
+ "> MOVE {destvar := } {Tret := }",
+ " -{ 123 MOV}- -{ srcvar MOV}-",
+ "",
+ " When the input to this instruction is true, it sets the given",
+ " destination variable equal to the given source variable or",
+ " constant. When the input to this instruction is false nothing",
+ " happens. You can assign to any variable with the move instruction;",
+ " this includes timer and counter state variables, which can be",
+ " distinguished by the leading `T' or `C'. For example, an instruction",
+ " moving 0 into `Tretentive' is equivalent to a reset (RES) instruction",
+ " for that timer. This instruction must be the rightmost instruction",
+ " in its rung.",
+ "",
+ "",
+ "> ARITHMETIC OPERATION {ADD kay :=} {SUB Ccnt :=}",
+ " -{ 'a' + 10 }- -{ Ccnt - 10 }-",
+ "",
+ "> {MUL dest :=} {DIV dv := }",
+ " -{ var * -990 }- -{ dv / -10000}-",
+ "",
+ " When the input to this instruction is true, it sets the given",
+ " destination variable equal to the given expression. The operands",
+ " can be either variables (including timer and counter variables)",
+ " or constants. These instructions use 16 bit signed math. Remember",
+ " that the result is evaluated every cycle when the input condition",
+ " true. If you are incrementing or decrementing a variable (i.e. if",
+ " the destination variable is also one of the operands) then you",
+ " probably don't want that; typically you would use a one-shot so that",
+ " it is evaluated only on the rising or falling edge of the input",
+ " condition. Divide truncates; 8 / 3 = 2. This instruction must be",
+ " the rightmost instruction in its rung.",
+ "",
+ "",
+ "> COMPARE [var ==] [var >] [1 >=]",
+ " -[ var2 ]- -[ 1 ]- -[ Ton]-",
+ "",
+ "> [var /=] [-4 < ] [1 <=]",
+ " -[ var2 ]- -[ vartwo]- -[ Cup]-",
+ "",
+ " If the input to this instruction is false then the output is false. If",
+ " the input is true then the output is true if and only if the given",
+ " condition is true. This instruction can be used to compare (equals,",
+ " is greater than, is greater than or equal to, does not equal,",
+ " is less than, is less than or equal to) a variable to a variable,",
+ " or to compare a variable to a 16-bit signed constant.",
+ "",
+ "",
+ "> COUNTER Cname Cname",
+ " --[CTU >=5]-- --[CTD >=5]--",
+ "",
+ " A counter increments (CTU, count up) or decrements (CTD, count",
+ " down) the associated count on every rising edge of the rung input",
+ " condition (i.e. what the rung input condition goes from false to",
+ " true). The output condition from the counter is true if the counter",
+ " variable is greater than or equal to 5, and false otherwise. The",
+ " rung output condition may be true even if the input condition is",
+ " false; it only depends on the counter variable. You can have CTU",
+ " and CTD instructions with the same name, in order to increment and",
+ " decrement the same counter. The RES instruction can reset a counter,",
+ " or you can perform general variable operations on the count variable.",
+ "",
+ "",
+ "> CIRCULAR COUNTER Cname",
+ " --{CTC 0:7}--",
+ "",
+ " A circular counter works like a normal CTU counter, except that",
+ " after reaching its upper limit, it resets its counter variable",
+ " back to 0. For example, the counter shown above would count 0, 1,",
+ " 2, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 2,.... This is useful in",
+ " combination with conditional statements on the variable `Cname';",
+ " you can use this like a sequencer. CTC counters clock on the rising",
+ " edge of the rung input condition condition. This instruction must",
+ " be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> SHIFT REGISTER {SHIFT REG }",
+ " -{ reg0..3 }-",
+ "",
+ " A shift register is associated with a set of variables. For example,",
+ " this shift register is associated with the variables `reg0', `reg1',",
+ " `reg2', and `reg3'. The input to the shift register is `reg0'. On",
+ " every rising edge of the rung-in condition, the shift register will",
+ " shift right. That means that it assigns `reg3 := reg2', `reg2 :=",
+ " reg1'. and `reg1 := reg0'. `reg0' is left unchanged. A large shift",
+ " register can easily consume a lot of memory. This instruction must",
+ " be the rightmost instruction in its rung.",
+ "",
+ "",
+ "> LOOK-UP TABLE {dest := }",
+ " -{ LUT[i] }-",
+ "",
+ " A look-up table is an ordered set of n values. When the rung-in",
+ " condition is true, the integer variable `dest' is set equal to the",
+ " entry in the lookup table corresponding to the integer variable",
+ " `i'. The index starts from zero, so `i' must be between 0 and",
+ " (n-1). The behaviour of this instruction is not defined if the",
+ " index is outside this range. This instruction must be the rightmost",
+ " instruction in its rung.",
+ "",
+ "",
+ "> PIECEWISE LINEAR TABLE {yvar := }",
+ " -{ PWL[xvar] }-",
+ "",
+ " This is a good way to approximate a complicated function or",
+ " curve. It might, for example, be useful if you are trying to apply",
+ " a calibration curve to convert a raw output voltage from a sensor",
+ " into more convenient units.",
+ "",
+ " Assume that you are trying to approximate a function that converts",
+ " an integer input variable, x, to an integer output variable, y. You",
+ " know the function at several points; for example, you might know that",
+ "",
+ " f(0) = 2",
+ " f(5) = 10",
+ " f(10) = 50",
+ " f(100) = 100",
+ "",
+ " This means that the points",
+ "",
+ " (x0, y0) = ( 0, 2)",
+ " (x1, y1) = ( 5, 10)",
+ " (x2, y2) = ( 10, 50)",
+ " (x3, y3) = (100, 100)",
+ "",
+ " lie on that curve. You can enter those 4 points into a table",
+ " associated with the piecewise linear instruction. The piecewise linear",
+ " instruction will look at the value of xvar, and set the value of",
+ " yvar. It will set yvar in such a way that the piecewise linear curve",
+ " will pass through all of the points that you give it; for example,",
+ " if you set xvar = 10, then the instruction will set yvar = 50.",
+ "",
+ " If you give the instruction a value of xvar that lies between two",
+ " of the values of x for which you have given it points, then the",
+ " instruction will set yvar so that (xvar, yvar) lies on the straight",
+ " line connecting those two points in the table. For example, xvar =",
+ " 55 gives an output of yvar = 75. (The two points in the table are",
+ " (10, 50) and (100, 100). 55 is half-way between 10 and 100, and 75",
+ " is half-way between 50 and 100, so (55, 75) lies on the line that",
+ " connects those two points.)",
+ "",
+ " The points must be specified in ascending order by x coordinate. It",
+ " may not be possible to perform mathematical operations required for",
+ " certain look-up tables using 16-bit integer math; if this is the",
+ " case, then LDmicro will warn you. For example, this look up table",
+ " will produce an error:",
+ "",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (300, 300)",
+ "",
+ " You can fix these errors by making the distance between points in",
+ " the table smaller. For example, this table is equivalent to the one",
+ " given above, and it does not produce an error:",
+ "",
+ " (x0, y0) = ( 0, 0)",
+ " (x1, y1) = (150, 150)",
+ " (x2, y2) = (300, 300)",
+ "",
+ " It should hardly ever be necessary to use more than five or six",
+ " points. Adding more points makes your code larger and slower to",
+ " execute. The behaviour if you pass a value of `xvar' greater than",
+ " the greatest x coordinate in the table or less than the smallest x",
+ " coordinate in the table is undefined. This instruction must be the",
+ " rightmost instruction in its rung.",
+ "",
+ "",
+ "> A/D CONVERTER READ Aname",
+ " --{READ ADC}--",
+ "",
+ " LDmicro can generate code to use the A/D converters built in to",
+ " certain microcontrollers. If the input condition to this instruction",
+ " is true, then a single sample from the A/D converter is acquired and",
+ " stored in the variable `Aname'. This variable can subsequently be",
+ " manipulated with general variable operations (less than, greater than,",
+ " arithmetic, and so on). Assign a pin to the `Axxx' variable in the",
+ " same way that you would assign a pin to a digital input or output,",
+ " by double-clicking it in the list at the bottom of the screen. If",
+ " the input condition to this rung is false then the variable `Aname'",
+ " is left unchanged.",
+ "",
+ " For all currently-supported devices, 0 volts input corresponds to",
+ " an ADC reading of 0, and an input equal to Vdd (the supply voltage)",
+ " corresponds to an ADC reading of 1023. If you are using an AVR, then",
+ " connect AREF to Vdd. You can use arithmetic operations to scale the",
+ " reading to more convenient units afterwards, but remember that you",
+ " are using integer math. In general not all pins will be available",
+ " for use with the A/D converter. The software will not allow you to",
+ " assign non-A/D pins to an analog input. This instruction must be",
+ " the rightmost instruction in its rung.",
+ "",
+ "",
+ "> SET PWM DUTY CYCLE duty_cycle",
+ " -{PWM 32.8 kHz}-",
+ "",
+ " LDmicro can generate code to use the PWM peripheral built in to",
+ " certain microcontrollers. If the input condition to this instruction",
+ " is true, then the duty cycle of the PWM peripheral is set to the",
+ " value of the variable duty_cycle. The duty cycle must be a number",
+ " between 0 and 100; 0 corresponds to always low, and 100 corresponds to",
+ " always high. (If you are familiar with how the PWM peripheral works,",
+ " then notice that that means that LDmicro automatically scales the",
+ " duty cycle variable from percent to PWM clock periods.)",
+ "",
+ " You can specify the target PWM frequency, in Hz. The frequency that",
+ " you specify might not be exactly achievable, depending on how it",
+ " divides into the microcontroller's clock frequency. LDmicro will",
+ " choose the closest achievable frequency; if the error is large then",
+ " it will warn you. Faster speeds may sacrifice resolution.",
+ "",
+ " This instruction must be the rightmost instruction in its rung.",
+ " The ladder logic runtime consumes one timer to measure the cycle",
+ " time. That means that PWM is only available on microcontrollers",
+ " with at least two suitable timers. PWM uses pin CCP2 (not CCP1)",
+ " on PIC16 chips and OC2 (not OC1A) on AVRs.",
+ "",
+ "",
+ "> MAKE PERSISTENT saved_var",
+ " --{PERSIST}--",
+ "",
+ " When the rung-in condition of this instruction is true, it causes the",
+ " specified integer variable to be automatically saved to EEPROM. That",
+ " means that its value will persist, even when the micro loses",
+ " power. There is no need to explicitly save the variable to EEPROM;",
+ " that will happen automatically, whenever the variable changes. The",
+ " variable is automatically loaded from EEPROM after power-on reset. If",
+ " a variable that changes frequently is made persistent, then the",
+ " EEPROM in your micro may wear out very quickly, because it is only",
+ " good for a limited (~100 000) number of writes. When the rung-in",
+ " condition is false, nothing happens. This instruction must be the",
+ " rightmost instruction in its rung.",
+ "",
+ "",
+ "> UART (SERIAL) RECEIVE var",
+ " --{UART RECV}--",
+ "",
+ " LDmicro can generate code to use the UART built in to certain",
+ " microcontrollers. On AVRs with multiple UARTs only UART1 (not",
+ " UART0) is supported. Configure the baud rate using Settings -> MCU",
+ " Parameters. Certain baud rates may not be achievable with certain",
+ " crystal frequencies; LDmicro will warn you if this is the case.",
+ "",
+ " If the input condition to this instruction is false, then nothing",
+ " happens. If the input condition is true then this instruction tries",
+ " to receive a single character from the UART. If no character is read",
+ " then the output condition is false. If a character is read then its",
+ " ASCII value is stored in `var', and the output condition is true",
+ " for a single PLC cycle.",
+ "",
+ "",
+ "> UART (SERIAL) SEND var",
+ " --{UART SEND}--",
+ "",
+ " LDmicro can generate code to use the UARTs built in to certain",
+ " microcontrollers. On AVRS with multiple UARTs only UART1 (not",
+ " UART0) is supported. Configure the baud rate using Settings -> MCU",
+ " Parameters. Certain baud rates may not be achievable with certain",
+ " crystal frequencies; LDmicro will warn you if this is the case.",
+ "",
+ " If the input condition to this instruction is false, then nothing",
+ " happens. If the input condition is true then this instruction writes",
+ " a single character to the UART. The ASCII value of the character to",
+ " send must previously have been stored in `var'. The output condition",
+ " of the rung is true if the UART is busy (currently transmitting a",
+ " character), and false otherwise.",
+ "",
+ " Remember that characters take some time to transmit. Check the output",
+ " condition of this instruction to ensure that the first character has",
+ " been transmitted before trying to send a second character, or use",
+ " a timer to insert a delay between characters. You must only bring",
+ " the input condition true (try to send a character) when the output",
+ " condition is false (UART is not busy).",
+ "",
+ " Investigate the formatted string instruction (next) before using this",
+ " instruction. The formatted string instruction is much easier to use,",
+ " and it is almost certainly capable of doing what you want.",
+ "",
+ "",
+ "> FORMATTED STRING OVER UART var",
+ " -{\"Pressure: \\3\\r\\n\"}-",
+ "",
+ " LDmicro can generate code to use the UARTs built in to certain",
+ " microcontrollers. On AVRS with multiple UARTs only UART1 (not",
+ " UART0) is supported. Configure the baud rate using Settings -> MCU",
+ " Parameters. Certain baud rates may not be achievable with certain",
+ " crystal frequencies; LDmicro will warn you if this is the case.",
+ "",
+ " When the rung-in condition for this instruction goes from false to",
+ " true, it starts to send an entire string over the serial port. If",
+ " the string contains the special sequence `\\3', then that sequence",
+ " will be replaced with the value of `var', which is automatically",
+ " converted into a string. The variable will be formatted to take",
+ " exactly 3 characters; for example, if `var' is equal to 35, then",
+ " the exact string printed will be `Pressure: 35\\r\\n' (note the extra",
+ " space). If instead `var' were equal to 1432, then the behaviour would",
+ " be undefined, because 1432 has more than three digits. In that case",
+ " it would be necessary to use `\\4' instead.",
+ "",
+ " If the variable might be negative, then use `\\-3d' (or `\\-4d'",
+ " etc.) instead. That will cause LDmicro to print a leading space for",
+ " positive numbers, and a leading minus sign for negative numbers.",
+ "",
+ " If multiple formatted string instructions are energized at once",
+ " (or if one is energized before another completes), or if these",
+ " instructions are intermixed with the UART TX instructions, then the",
+ " behaviour is undefined.",
+ "",
+ " It is also possible to use this instruction to output a fixed string,",
+ " without interpolating an integer variable's value into the text that",
+ " is sent over serial. In that case simply do not include the special",
+ " escape sequence.",
+ "",
+ " Use `\\\\' for a literal backslash. In addition to the escape sequence",
+ " for interpolating an integer variable, the following control",
+ " characters are available:",
+ " * \\r -- carriage return",
+ " * \\n -- newline",
+ " * \\f -- formfeed",
+ " * \\b -- backspace",
+ " * \\xAB -- character with ASCII value 0xAB (hex)",
+ "",
+ " The rung-out condition of this instruction is true while it is",
+ " transmitting data, else false. This instruction consumes a very",
+ " large amount of program memory, so it should be used sparingly. The",
+ " present implementation is not efficient, but a better one will",
+ " require modifications to all the back-ends.",
+ "",
+ "",
+ "A NOTE ON USING MATH",
+ "====================",
+ "",
+ "Remember that LDmicro performs only 16-bit integer math. That means",
+ "that the final result of any calculation that you perform must be an",
+ "integer between -32768 and 32767. It also mean that the intermediate",
+ "results of your calculation must all be within that range.",
+ "",
+ "For example, let us say that you wanted to calculate y = (1/x)*1200,",
+ "where x is between 1 and 20. Then y goes between 1200 and 60, which",
+ "fits into a 16-bit integer, so it is at least in theory possible to",
+ "perform the calculation. There are two ways that you might code this:",
+ "you can perform the reciprocal, and then multiply:",
+ "",
+ " || {DIV temp :=} ||",
+ " ||---------{ 1 / x }----------||",
+ " || ||",
+ " || {MUL y := } ||",
+ " ||----------{ temp * 1200}----------||",
+ " || ||",
+ "",
+ "Or you could just do the division directly, in a single step:",
+ "",
+ " || {DIV y :=} ||",
+ " ||-----------{ 1200 / x }-----------||",
+ "",
+ "Mathematically, these two are equivalent; but if you try them, then you",
+ "will find that the first one gives an incorrect result of y = 0. That",
+ "is because the variable `temp' underflows. For example, when x = 3,",
+ "(1 / x) = 0.333, but that is not an integer; the division operation",
+ "approximates this as temp = 0. Then y = temp * 1200 = 0. In the second",
+ "case there is no intermediate result to underflow, so everything works.",
+ "",
+ "If you are seeing problems with your math, then check intermediate",
+ "results for underflow (or overflow, which `wraps around'; for example,",
+ "32767 + 1 = -32768). When possible, choose units that put values in",
+ "a range of -100 to 100.",
+ "",
+ "When you need to scale a variable by some factor, do it using a multiply",
+ "and a divide. For example, to scale y = 1.8*x, calculate y = (9/5)*x",
+ "(which is the same, since 1.8 = 9/5), and code this as y = (9*x)/5,",
+ "performing the multiplication first:",
+ "",
+ " || {MUL temp :=} ||",
+ " ||---------{ x * 9 }----------||",
+ " || ||",
+ " || {DIV y :=} ||",
+ " ||-----------{ temp / 5 }-----------||",
+ "",
+ "This works for all x < (32767 / 9), or x < 3640. For larger values of x,",
+ "the variable `temp' would overflow. There is a similar lower limit on x.",
+ "",
+ "",
+ "CODING STYLE",
+ "============",
+ "",
+ "I allow multiple coils in parallel in a single rung. This means that",
+ "you can do things like this:",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || Xb Yb ||",
+ " ||-------] [------+-------( )-------||",
+ " || | ||",
+ " || | Yc ||",
+ " || +-------( )-------||",
+ " || ||",
+ "",
+ "Instead of this:",
+ "",
+ " || Xa Ya ||",
+ " 1 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yb ||",
+ " 2 ||-------] [--------------( )-------||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || Xb Yc ||",
+ " 3 ||-------] [--------------( )-------||",
+ " || ||",
+ "",
+ "This means that in theory you could write any program as one giant rung,",
+ "and there is no need to use multiple rungs at all. In practice that",
+ "would be a bad idea, because as rungs become more complex they become",
+ "more difficult to edit without deleting and redrawing a lot of logic.",
+ "",
+ "Still, it is often a good idea to group related logic together as a single",
+ "rung. This generates nearly identical code to if you made separate rungs,",
+ "but it shows that they are related when you look at them on the ladder",
+ "diagram.",
+ "",
+ " * * *",
+ "",
+ "In general, it is considered poor form to write code in such a way that",
+ "its output depends on the order of the rungs. For example, this code",
+ "isn't very good if both Xa and Xb might ever be true:",
+ "",
+ " || Xa {v := } ||",
+ " 1 ||-------] [--------{ 12 MOV}--||",
+ " || ||",
+ " || Xb {v := } ||",
+ " ||-------] [--------{ 23 MOV}--||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || ||",
+ " || [v >] Yc ||",
+ " 2 ||------[ 15]-------------( )-------||",
+ " || ||",
+ "",
+ "I will break this rule if in doing so I can make a piece of code",
+ "significantly more compact, though. For example, here is how I would",
+ "convert a 4-bit binary quantity on Xb3:0 into an integer:",
+ "",
+ " || {v := } ||",
+ " 3 ||-----------------------------------{ 0 MOV}--||",
+ " || ||",
+ " || Xb0 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 1 }-----------||",
+ " || ||",
+ " || Xb1 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 2 }-----------||",
+ " || ||",
+ " || Xb2 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 4 }-----------||",
+ " || ||",
+ " || Xb3 {ADD v :=} ||",
+ " ||-------] [------------------{ v + 8 }-----------||",
+ " || ||",
+ "",
+ "If the MOV statement were moved to the bottom of the rung instead of the",
+ "top, then the value of v when it is read elsewhere in the program would",
+ "be 0. The output of this code therefore depends on the order in which",
+ "the instructions are evaluated. Considering how cumbersome it would be",
+ "to code this any other way, I accept that.",
+ "",
+ "",
+ "BUGS",
+ "====",
+ "",
+ "LDmicro does not generate very efficient code; it is slow to execute, and",
+ "wasteful of flash and RAM. In spite of this, a mid-sized PIC or AVR can",
+ "do everything that a small PLC can, so this does not bother me very much.",
+ "",
+ "The maximum length of variable names is highly limited. This is so that",
+ "they fit nicely onto the ladder diagram, so I don't see a good solution",
+ "to that.",
+ "",
+ "If your program is too big for the time, program memory, or data memory",
+ "constraints of the device that you have chosen then you probably won't",
+ "get an error. It will just screw up somewhere.",
+ "",
+ "Careless programming in the file load/save routines probably makes it",
+ "possible to crash or execute arbitrary code given a corrupt or malicious",
+ ".ld file.",
+ "",
+ "Please report additional bugs or feature requests to the author.",
+ "",
+ "Thanks to:",
+ " * Marcelo Solano, for reporting a UI bug under Win98",
+ " * Serge V. Polubarjev, for not only noticing that RA3:0 on the",
+ " PIC16F628 didn't work but also telling me how to fix it",
+ " * Maxim Ibragimov, for reporting and diagnosing major problems",
+ " with the till-then-untested ATmega16 and ATmega162 targets",
+ " * Bill Kishonti, for reporting that the simulator crashed when the",
+ " ladder logic program divided by zero",
+ " * Mohamed Tayae, for reporting that persistent variables were broken",
+ " on the PIC16F628",
+ " * David Rothwell, for reporting several user interface bugs and a",
+ " problem with the \"Export as Text\" function",
+ "",
+ "",
+ "COPYING, AND DISCLAIMER",
+ "=======================",
+ "",
+ "DO NOT USE CODE GENERATED BY LDMICRO IN APPLICATIONS WHERE SOFTWARE",
+ "FAILURE COULD RESULT IN DANGER TO HUMAN LIFE OR DAMAGE TO PROPERTY. THE",
+ "AUTHOR ASSUMES NO LIABILITY FOR ANY DAMAGES RESULTING FROM THE OPERATION",
+ "OF LDMICRO OR CODE GENERATED BY LDMICRO.",
+ "",
+ "This program is free software: you can redistribute it and/or modify it",
+ "under the terms of the GNU General Public License as published by the",
+ "Free Software Foundation, either version 3 of the License, or (at your",
+ "option) any later version.",
+ "",
+ "This program is distributed in the hope that it will be useful, but",
+ "WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY",
+ "or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License",
+ "for more details.",
+ "",
+ "You should have received a copy of the GNU General Public License along",
+ "with this program. If not, see <http://www.gnu.org/licenses/>.",
+ "",
+ "",
+ "Jonathan Westhues",
+ "",
+ "Rijswijk -- Dec 2004",
+ "Waterloo ON -- Jun, Jul 2005",
+ "Cambridge MA -- Sep, Dec 2005",
+ " Feb, Mar 2006",
+ " Feb 2007",
+ "Seattle WA -- Feb 2009",
+ "",
+ "Email: user jwesthues, at host cq.cx",
+ "",
+ "",
+ NULL
+};
+#endif
+
diff --git a/ldmicro/obj/lang-tables.h b/ldmicro/obj/lang-tables.h new file mode 100644 index 0000000..8b290d6 --- /dev/null +++ b/ldmicro/obj/lang-tables.h @@ -0,0 +1,1568 @@ +#ifdef LDLANG_DE
+static LangTable LangDeTable[] = {
+ { "Target frequency %d Hz, closest achievable is %d Hz (warning, >5%% error).", "Zielfrequenz %d Hz, nächste erreichbare ist %d Hz (Warnung, >5% Abweichung)." },
+ { "Compile successful; wrote IHEX for AVR to '%s'.\r\n\r\nRemember to set the processor configuration (fuses) correctly. This does not happen automatically.", "Kompilierung war erfolgreich. IHEX für AVR gespeichert unter '%s'.\r\n\r\n Die Prozessor-Konfigurationsbits müssen richtig gesetzt werden. Dies geschieht nicht automatisch" },
+ { "( ) Normal", "( ) Normal" },
+ { "(/) Negated", "(/) Negiert" },
+ { "(S) Set-Only", "(S) Setzen" },
+ { "(R) Reset-Only", "(R) Rücksetzen" },
+ { "Pin on MCU", "Prozessorpin" },
+ { "Coil", "Spule" },
+ { "Comment", "Kommentar" },
+ { "Cycle Time (ms):", "Zykluszeit (ms):" },
+ { "Crystal Frequency (MHz):", "Quarzfrequenz (MHz):" },
+ { "UART Baud Rate (bps):", "UART Baudrate (bps):" },
+ { "Serial (UART) will use pins %d and %d.\r\n\r\n", "Serielles (UART) verwendet die Pins %d und %d.\r\n\r\n" },
+ { "Please select a micro with a UART.\r\n\r\n", "Einen Prozessor mit UART wählen.\r\n\r\n" },
+ { "No serial instructions (UART Send/UART Receive) are in use; add one to program before setting baud rate.\r\n\r\n", "Keine UART-Anweisung Senden/Empfangen gefunden; die Baudrate festlegen, wenn diese Anweisung verwendet wird.\r\n\r\n" },
+ { "The cycle time for the 'PLC' runtime generated by LDmicro is user-configurable. Very short cycle times may not be achievable due to processor speed constraints, and very long cycle times may not be achievable due to hardware overflows. Cycle times between 10 ms and 100 ms will usually be practical.\r\n\r\nThe compiler must know what speed crystal you are using with the micro to convert between timing in clock cycles and timing in seconds. A 4 MHz to 20 MHz crystal is typical; check the speed grade of the part you are using to determine the maximum allowable clock speed before choosing a crystal.", "Die von LDmicro erzeugte Zykluszeit des SPS-Ablaufs ist vom Anwender konfigurierbar. Sehr kurze Zykluszeiten können wegen Prozessorbeschränkungen nicht erreichbar sein, und sehr lange Zykluszeiten können wegen Hardware-Überlaufs nicht erreichbar sein. Zykluszeiten zwischen 10 ms und 100 ms sind üblich.\r\n\r\nFür die Umrechnung des Taktzykluses und der Zeitberechnung in Sekunden, muss der Compiler wissen, welche Quarzfrequenz beim Prozessor verwendet wird. Ein Quarz mit 4 bis 20 MHz ist üblich; Überprüfen Sie die Geschwindigkeit Ihres Prozessors, um die maximal erlaubte Taktgeschwindigkeit zu bestimmen, bevor Sie einen Quarz wählen." },
+ { "PLC Configuration", "SPS-Konfiguration" },
+ { "Zero cycle time not valid; resetting to 10 ms.", "Zykluszeit = 0, nicht zulässig; wird auf 10 ms gesetzt." },
+ { "Source", "Quelle" },
+ { "Internal Relay", "Merker" },
+ { "Input pin", "Eingangspin" },
+ { "Output pin", "Ausgangspin" },
+ { "|/| Negated", "|/| Negiert" },
+ { "Contacts", "Kontakte" },
+ { "No ADC or ADC not supported for selected micro.", "Kein A/D-Wandler vorhanden oder A/D-Wandler wird vom gewählten Prozessor nicht unterstützt." },
+ { "Assign:", "Zuweisen:" },
+ { "No microcontroller has been selected. You must select a microcontroller before you can assign I/O pins.\r\n\r\nSelect a microcontroller under the Settings menu and try again.", "Kein Prozessor gewählt. Sie müssen einen Prozessor wählen, bevor Sie E/A Pins zuweisen können.\r\n\r\nWählen Sie einen Prozessor im Voreinstellungs-Menu und versuchen es noch mal." },
+ { "I/O Pin Assignment", "E/A Pin Zuweisung" },
+ { "Can't specify I/O assignment for ANSI C target; compile and see comments in generated source code.", "Keine E/A Zuweisung für ANSI C-Ziel möglich; kompilieren Sie und beachten die Kommentare im erzeugten Quellcode." },
+ { "Can't specify I/O assignment for interpretable target; see comments in reference implementation of interpreter.", "Keine E/A Zuweisung für ANSI C-Ziel möglich; beachten Sie die Kommentare der Referenz-Ausführung des Interpreters." },
+ { "Can only assign pin number to input/output pins (Xname or Yname or Aname).", "Nur für Ein- und Ausgangspins können Pin-Nummern vergeben werden (XName oder YName oder AName)." },
+ { "No ADC or ADC not supported for this micro.", "Kein A/D-Wandler vorhanden oder A/D-Wandler wird vom gewählten Prozessor nicht unterstützt." },
+ { "Rename I/O from default name ('%s') before assigning MCU pin.", "Die Standardbezeichnung ('%s') des E/A’s vor der Zuweisung des Prozessorpins ändern." },
+ { "I/O Pin", "E/A Pin" },
+ { "(no pin)", "(kein Pin)" },
+ { "<UART needs!>", "<UART benötigt!>" },
+ { "<PWM needs!>", "<PWM benötigt!>" },
+ { "<not an I/O!>", "<kein E/A!>" },
+ { "Export As Text", "Als Text exportieren" },
+ { "Couldn't write to '%s'.", "Speichern nicht möglich unter '%s'." },
+ { "Compile To", "Kompilieren unter" },
+ { "Must choose a target microcontroller before compiling.", "Vor dem Kompilieren muss ein Prozessor gewählt werden." },
+ { "UART function used but not supported for this micro.", "Dieser Prozessor unterstützt keine UART-Funktion." },
+ { "PWM function used but not supported for this micro.", "Dieser Prozessor unterstützt keine PWM-Funktion." },
+ { "The program has changed since it was last saved.\r\n\r\nDo you want to save the changes?", "Das Programm wurde nach dem letzten Speichern geändert.\r\n\r\n Möchten Sie die Änderungen speichern?" },
+ { "--add comment here--", "--Hier Komentar einfügen--" },
+ { "Start new program?", "Neues Programm starten?" },
+ { "Couldn't open '%s'.", "Kann nicht geöffnet werden '%s'." },
+ { "Name", "Name" },
+ { "State", "Status" },
+ { "Pin on Processor", "Prozessorpin" },
+ { "MCU Port", "Prozessor-Port" },
+ { "LDmicro - Simulation (Running)", "LDmicro - Simulation (am Laufen)" },
+ { "LDmicro - Simulation (Stopped)", "LDmicro - Simulation (Angehalten)" },
+ { "LDmicro - Program Editor", "LDmicro – Programm-Editor" },
+ { " - (not yet saved)", " - (noch nicht gespeichert)" },
+ { "&New\tCtrl+N", "&Neu\tStrg+N" },
+ { "&Open...\tCtrl+O", "&Öffnen...\tStrg+O" },
+ { "&Save\tCtrl+S", "&Speichern\tStrg+S" },
+ { "Save &As...", "Speichern &unter..." },
+ { "&Export As Text...\tCtrl+E", "&Als Text exportieren...\tStrg+E" },
+ { "E&xit", "&Beenden" },
+ { "&Undo\tCtrl+Z", "&Aufheben\tStrg+Z" },
+ { "&Redo\tCtrl+Y", "&Wiederherstellen\tStrg+Y" },
+ { "Insert Rung &Before\tShift+6", "Netzwerk Einfügen &Davor\tShift+6" },
+ { "Insert Rung &After\tShift+V", "Netzwerk Einfügen &Danach\tShift+V" },
+ { "Move Selected Rung &Up\tShift+Up", "Gewähltes Netzwerk schieben &nach oben\tShift+Up" },
+ { "Move Selected Rung &Down\tShift+Down", "Gewähltes Netzwerk schieben &nach unten\tShift+Down" },
+ { "&Delete Selected Element\tDel", "&Gewähltes Element löschen\tEntf" },
+ { "D&elete Rung\tShift+Del", "Netzwerk löschen\tShift+Entf" },
+ { "Insert Co&mment\t;", "Kommentar &einfügen\t;" },
+ { "Insert &Contacts\tC", "Kontakt &einfügen\tC" },
+ { "Insert OSR (One Shot Rising)\t&/", "OSR einfügen (Steigende Flanke)\t&/" },
+ { "Insert OSF (One Shot Falling)\t&\\", "OSF einfügen (Fallende Flanke)\t&\\" },
+ { "Insert T&ON (Delayed Turn On)\tO", "T&ON einfügen (Anzugsverzögerung)\tO" },
+ { "Insert TO&F (Delayed Turn Off)\tF", "TO&F einfügen (Abfallverzögerung)\tF" },
+ { "Insert R&TO (Retentive Delayed Turn On)\tT", "R&TO einfügen (Speichernde Anzugsverzögerung)\tT" },
+ { "Insert CT&U (Count Up)\tU", "CT&U einfügen (Aufwärtszähler)\tU" },
+ { "Insert CT&D (Count Down)\tI", "CT&D einfügen (Abwärtszähler)\tI" },
+ { "Insert CT&C (Count Circular)\tJ", "CT&C einfügen (Zirkulierender Zähler)\tJ" },
+ { "Insert EQU (Compare for Equals)\t=", "EQU einfügen (Vergleich auf gleich)\t=" },
+ { "Insert NEQ (Compare for Not Equals)", "NEQ einfügen (Vergleich auf ungleich)" },
+ { "Insert GRT (Compare for Greater Than)\t>", "GRT einfügen (Vergleich auf größer)\t>" },
+ { "Insert GEQ (Compare for Greater Than or Equal)\t.", "GEQ einfügen (Vergleich auf größer oder gleich)\t." },
+ { "Insert LES (Compare for Less Than)\t<", "LES einfügen (Vergleich auf kleiner)\t<" },
+ { "Insert LEQ (Compare for Less Than or Equal)\t,", "LEQ einfügen (Vergleich auf kleiner oder gleich)\t," },
+ { "Insert Open-Circuit", "Öffnung einfügen" },
+ { "Insert Short-Circuit", "Brücke einfügen" },
+ { "Insert Master Control Relay", "Master Control Relais einfügen" },
+ { "Insert Coi&l\tL", "Spule einfügen \tL" },
+ { "Insert R&ES (Counter/RTO Reset)\tE", "R&ES einfügen (RTO/Zähler rücksetzen)\tE" },
+ { "Insert MOV (Move)\tM", "Transferieren (Move) einfügen\tM" },
+ { "Insert ADD (16-bit Integer Add)\t+", "ADD einfügen (16-bit Ganzzahl Addierer)\t+" },
+ { "Insert SUB (16-bit Integer Subtract)\t-", "SUB einfügen (16-bit Ganzzahl Subtrahierer)\t-" },
+ { "Insert MUL (16-bit Integer Multiply)\t*", "MUL einfügen (16-bit Ganzzahl Multiplizierer)\t*" },
+ { "Insert DIV (16-bit Integer Divide)\tD", "DIV einfügen (16-bit Ganzzahl Dividierer)\tD" },
+ { "Insert Shift Register", "Schieberegister einfügen" },
+ { "Insert Look-Up Table", "Nachschlag-Tabelle einfügen" },
+ { "Insert Piecewise Linear", "Näherungs-Linear-Tabelle einfügen" },
+ { "Insert Formatted String Over UART", "Formatierte Zeichenfolge über UART einfügen" },
+ { "Insert &UART Send", "&UART Senden einfügen" },
+ { "Insert &UART Receive", "&UART Empfangen einfügen" },
+ { "Insert Set PWM Output", "PWM Ausgang einfügen" },
+ { "Insert A/D Converter Read\tP", "A/D-Wandler Einlesen einfügen\tP" },
+ { "Insert Make Persistent", "Remanent machen einfügen" },
+ { "Make Norm&al\tA", "Auf Normal ändern\tA" },
+ { "Make &Negated\tN", "Auf &Negieren ändern\tN" },
+ { "Make &Set-Only\tS", "Auf &Setzen ändern\tS" },
+ { "Make &Reset-Only\tR", "Auf &Rücksetzen ändern\tR" },
+ { "&MCU Parameters...", "&Prozessor-Parameter..." },
+ { "(no microcontroller)", "(kein Prozessor)" },
+ { "&Microcontroller", "&Mikroprozessor" },
+ { "Si&mulation Mode\tCtrl+M", "Simulationsbetrieb\tStrg+M" },
+ { "Start &Real-Time Simulation\tCtrl+R", "Start &Echtzeit- Simulation\tStrg+R" },
+ { "&Halt Simulation\tCtrl+H", "&Simulation Anhalten\tStrg+H" },
+ { "Single &Cycle\tSpace", "&Einzelzyklus\tLeertaste" },
+ { "&Compile\tF5", "&Kompilieren\tF5" },
+ { "Compile &As...", "Kompilieren &unter..." },
+ { "&Manual...\tF1", "&Handbuch...\tF1" },
+ { "&About...", "&Über LDmicro..." },
+ { "&File", "&Datei" },
+ { "&Edit", "&Bearbeiten" },
+ { "&Settings", "&Voreinstellungen" },
+ { "&Instruction", "&Anweisung" },
+ { "Si&mulate", "Simulieren" },
+ { "&Compile", "&Kompilieren" },
+ { "&Help", "&Hilfe" },
+ { "no MCU selected", "kein Prozessor gewählt" },
+ { "cycle time %.2f ms", "Zykluszeit %.2f ms" },
+ { "processor clock %.4f MHz", "Taktfrequenz Prozessor %.4f MHz" },
+ { "Internal error relating to PIC paging; make program smaller or reshuffle it.", "Interner Fehler beim PIC paging Seitenwechsel; Programm verkleinern oder umbilden" },
+ { "PWM frequency too fast.", "PWM Frequenz zu schnell." },
+ { "PWM frequency too slow.", "PWM Frequenz zu langsam." },
+ { "Cycle time too fast; increase cycle time, or use faster crystal.", "Zykluszeit zu schnell; Zykluszeit vergrößern oder schnelleren Quarz wählen." },
+ { "Cycle time too slow; decrease cycle time, or use slower crystal.", "Zykluszeit zu langsam; Zykluszeit verringern oder langsameren Quarz wählen." },
+ { "Couldn't open file '%s'", "Datei konnte nicht geöffnet werden '%s'" },
+ { "Zero baud rate not possible.", "Baudrate = 0 nicht möglich" },
+ { "Compile successful; wrote IHEX for PIC16 to '%s'.\r\n\r\nConfiguration word (fuses) has been set for crystal oscillator, BOD enabled, LVP disabled, PWRT enabled, all code protection off.\r\n\r\nUsed %d/%d words of program flash (chip %d%% full).", "Kompilierung war erfolgreich; IHEX für PIC16 gespeichert unter '%s'.\r\n\r\nKonfigurations-Wort (fuse) für Quarz-Oszillator festgelegt, BOD aktiviert, LVP gesperrt, PWRT aktiviert, Verschlüsselungsschutz aus.\r\n\r\nVerwendete %d/%d Worte des Flash-Speichers (Chip %d%% voll)." },
+ { "Type", "Typ" },
+ { "Timer", "Timer" },
+ { "Counter", "Zähler" },
+ { "Reset", "Rücksetzen" },
+ { "OK", "OK" },
+ { "Cancel", "Abbrechen" },
+ { "Empty textbox; not permitted.", "Leere Testbox; nicht erlaubt" },
+ { "Bad use of quotes: <%s>", "Quoten falsch verwendet: <%s>" },
+ { "Turn-On Delay", "Anzugsverzögerung" },
+ { "Turn-Off Delay", "Abfallverzögerung" },
+ { "Retentive Turn-On Delay", "Speichernde Anzugsverzögerung" },
+ { "Delay (ms):", "Verzögerung (ms):" },
+ { "Delay too long; maximum is 2**31 us.", "Verzögerung zu lang; maximal 2**31 us." },
+ { "Delay cannot be zero or negative.", "Verzögerung kann nicht gleich Null oder negativ sein." },
+ { "Count Up", "Aufwärtszählen" },
+ { "Count Down", "Abwärtszählen" },
+ { "Circular Counter", "Zirkulierender Zähler" },
+ { "Max value:", "Maximalwert:" },
+ { "True if >= :", "Wahr wenn >= :" },
+ { "If Equals", "Wenn gleich" },
+ { "If Not Equals", "Wenn ungleich" },
+ { "If Greater Than", "Wenn größer als" },
+ { "If Greater Than or Equal To", "Wenn größer als oder gleich" },
+ { "If Less Than", "Wenn kleiner als" },
+ { "If Less Than or Equal To", "Wenn kleiner als oder gleich" },
+ { "'Closed' if:", "'Geschlossen' wenn:" },
+ { "Move", "Transferieren" },
+ { "Read A/D Converter", "A/D-Wandler einlesen" },
+ { "Duty cycle var:", "Einsatzzyklus Var:" },
+ { "Frequency (Hz):", "Frequenz (Hz):" },
+ { "Set PWM Duty Cycle", "PWM Einsatzzyklus eingeben" },
+ { "Source:", "Quelle:" },
+ { "Receive from UART", "Mit UART empfangen" },
+ { "Send to UART", "Mit UART senden" },
+ { "Add", "Addieren" },
+ { "Subtract", "Subtrahieren" },
+ { "Multiply", "Multiplizieren" },
+ { "Divide", "Dividieren" },
+ { "Destination:", "Ziel:" },
+ { "is set := :", "gesetzt auf := :" },
+ { "Name:", "Name:" },
+ { "Stages:", "Stufen:" },
+ { "Shift Register", "Schieberegister" },
+ { "Not a reasonable size for a shift register.", "Kein angemessenes Format für ein Schieberegister." },
+ { "String:", "Zeichensatz:" },
+ { "Formatted String Over UART", "Formatierter Zeichensatz über UART" },
+ { "Variable:", "Variable:" },
+ { "Make Persistent", "Remanent machen" },
+ { "Too many elements in subcircuit!", "Zu viele Elemente im Netzwerk!" },
+ { "Too many rungs!", "Zu viele Netzwerke!" },
+ { "Error", "Fehler" },
+ { "ANSI C target does not support peripherals (UART, PWM, ADC, EEPROM). Skipping that instruction.", "ANSI C Zieldatei unterstützt keine Peripherien (wie UART, ADC, EEPROM). Die Anweisung wird ausgelassen." },
+ { "Compile successful; wrote C source code to '%s'.\r\n\r\nThis is not a complete C program. You have to provide the runtime and all the I/O routines. See the comments in the source code for information about how to do this.", "Die Kompilierung war erfolgreich; der C-Quellcode wurde gespeichert unter '%s'.\r\n\r\nDies ist kein komplettes C-Programm. Sie müssen die Laufzeit und alle E/A Routinen vorgeben. Siehe die Kommentare im Quellcode für Informationen, wie man das macht." },
+ { "Cannot delete rung; program must have at least one rung.", "Das Netzwerk nicht löschbar, das Programm muss mindestens ein Netzwerk haben." },
+ { "Out of memory; simplify program or choose microcontroller with more memory.", "Speicher voll; vereinfachen Sie das Programm oder wählen Sie einen Prozessor mit mehr Speicherkapazität." },
+ { "Must assign pins for all ADC inputs (name '%s').", "Für alle ADC-Eingänge müssen Pins zugewiesen werden (Name '%s')." },
+ { "Internal limit exceeded (number of vars)", "Interne Begrenzung überschritten (Anzahl der Variablen)" },
+ { "Internal relay '%s' never assigned; add its coil somewhere.", "Keine Zuweisung für Merker '%s', vergeben Sie eine Spule im Programm." },
+ { "Must assign pins for all I/O.\r\n\r\n'%s' is not assigned.", "Für alle E/A's müssen Pins zugewiesen werden.\r\n\r\n'%s' ist nicht zugewiesen." },
+ { "UART in use; pins %d and %d reserved for that.", "UART in Verwendung; Pins %d und %d sind hierfür reserviert." },
+ { "PWM in use; pin %d reserved for that.", "PWM in Verwendung; Pin %d hierfür reserviert." },
+ { "UART baud rate generator: divisor=%d actual=%.4f for %.2f%% error.\r\n\r\nThis is too large; try a different baud rate (slower probably), or a crystal frequency chosen to be divisible by many common baud rates (e.g. 3.6864 MHz, 14.7456 MHz).\r\n\r\nCode will be generated anyways but serial may be unreliable or completely broken.", "UART Baudraten-Generator: Divisor=%d aktuell=%.4f für %.2f%% Fehler.\r\n\r\nDiese ist zu hoch; versuchen Sie es mit einer anderen Baudrate (wahrscheinlich langsamer), oder eine Quarzfrequenz wählen die von vielen üblichen Baudraten teilbar ist (wie 3.6864MHz, 14.7456MHz).\r\n\r\nCode wird trotzdem erzeugt, aber er kann unzuverlässig oder beschädigt sein." },
+ { "UART baud rate generator: too slow, divisor overflows. Use a slower crystal or a faster baud rate.\r\n\r\nCode will be generated anyways but serial will likely be completely broken.", "UART Baudraten-Generator: Zu langsam, der Divisor hat Überlauf. Einen langsameren Quarz oder schnellere Baudrate verwenden.\r\n\r\nCode wird trotzdem erzeugt, aber er wird wahrscheinlich beschädigt sein." },
+ { "Couldn't open '%s'\n", "Konnte nicht geöffnet werden '%s'\n" },
+ { "Timer period too short (needs faster cycle time).", "Timer-Intervall zu kurz (schnellere Zykluszeit nötig)." },
+ { "Timer period too long (max 32767 times cycle time); use a slower cycle time.", "Timer-Intervall zu lang (max. 32767mal die Zykluszeit); langsamere Zykluszeit verwenden." },
+ { "Constant %d out of range: -32768 to 32767 inclusive.", "Konstante %d außerhalb des Bereichs: -32768 bis 32767 inklusive." },
+ { "Move instruction: '%s' not a valid destination.", "Transfer-Anweisung: '%s' ist keine gültige Zieladresse." },
+ { "Math instruction: '%s' not a valid destination.", "Mathem. Anweisung: '%s'keine gültige Zieladresse." },
+ { "Piecewise linear lookup table with zero elements!", "Näherungs-Linear-Tabelle ohne Elemente!" },
+ { "x values in piecewise linear table must be strictly increasing.", "Die x-Werte in der Näherungs-Linear-Tabelle müssen strikt aufsteigend sein." },
+ { "Numerical problem with piecewise linear lookup table. Either make the table entries smaller, or space the points together more closely.\r\n\r\nSee the help file for details.", "Zahlenmäßiges Problem mit der Näherungs-Linear-Tabelle. Entweder die Eingangswerte der Tabelle verringern, oder die Punkte näher zusammen legen.\r\n\r\nFür Details siehe unter Hilfe." },
+ { "Multiple escapes (\\0-9) present in format string, not allowed.", "Mehrfacher Zeilenumbruch (\\0-9)in formatierter Zeichenfolge nicht gestattet." },
+ { "Bad escape: correct form is \\xAB.", "Falscher Zeilenumbruch: Korrekte Form = \\xAB." },
+ { "Bad escape '\\%c'", "Falscher Zeilenumbruch '\\%c'" },
+ { "Variable is interpolated into formatted string, but none is specified.", "Formatierte Zeichenfolge enthält Variable, aber keine ist angegeben." },
+ { "No variable is interpolated into formatted string, but a variable name is specified. Include a string like '\\-3', or leave variable name blank.", "Keine Variable in formatierter Zeichenfolge eingefügt, aber ein Variabelen-Name wurde vergeben. Geben Sie eine Zeichenfolge ein, wie z.B. '\\-3', oder den Variabelen-Namen unausgefüllt lassen." },
+ { "Empty row; delete it or add instructions before compiling.", "Leere Reihe; vor dem Kompilieren löschen oder Anweisungen einfügen." },
+ { "Couldn't write to '%s'", "Nicht möglich, speichern unter '%s'." },
+ { "Unsupported op (anything ADC, PWM, UART, EEPROM) for interpretable target.", "Keine unterstützte Operation der interpretierbaren Zieldatei (kein ADC, PWM, UART, EEPROM möglich)." },
+ { "Compile successful; wrote interpretable code to '%s'.\r\n\r\nYou probably have to adapt the interpreter to your application. See the documentation.", "Kompilierung war erfolgreich; interpretierbarer Code gespeichert unter '%s'.\r\n\r\nWahrscheinlich müssen Sie den Interpreter an Ihre Anwendung anpassen. Siehe Dokumentation." },
+ { "Microcontroller '%s' not supported.\r\n\r\nDefaulting to no selected MCU.", "Prozessor '%s' nicht unterstützt.\r\n\r\nZurück zu: Kein Prozessor gewählt." },
+ { "File format error; perhaps this program is for a newer version of LDmicro?", "Fehler beim Dateiformat; vielleicht ist dies ein Programm für eine neuere Version von LDmicro." },
+ { "Index:", "Liste:" },
+ { "Points:", "Punkte:" },
+ { "Count:", "Berechnung:" },
+ { "Edit table of ASCII values like a string", "ASCII-Werte Tabelle als Zeichenfolge ausgeben" },
+ { "Look-Up Table", "Nachschlag-Tabelle" },
+ { "Piecewise Linear Table", "Näherungs-Linear-Tabelle" },
+ { "LDmicro Error", "Fehler LDmicro" },
+ { "Compile Successful", "Kompilierung war erfolgreich" },
+ { "digital in", "Digitaler Eingang" },
+ { "digital out", "Digitaler Ausgang" },
+ { "int. relay", "Merker" },
+ { "UART tx", "UART tx" },
+ { "UART rx", "UART rx" },
+ { "PWM out", "PWM Ausgang" },
+ { "turn-on delay", "Anzugsverzögerung" },
+ { "turn-off delay", "Abfallverzögerung" },
+ { "retentive timer", "Speichernder Timer" },
+ { "counter", "Zähler" },
+ { "general var", "Allg. Variable" },
+ { "adc input", "ADC Eingang" },
+ { "<corrupt!>", "<beschädigt!>" },
+ { "(not assigned)", "(nicht zugewiesen)" },
+ { "<no UART!>", "<kein UART!>" },
+ { "<no PWM!>", "<kein PWM!>" },
+ { "TOF: variable cannot be used elsewhere", "TOF: Variable kann andernorts nicht verwendet werden" },
+ { "TON: variable cannot be used elsewhere", "TON: Variable kann andernorts nicht verwendet werden" },
+ { "RTO: variable can only be used for RES elsewhere", "RTO: Variable kann andernorts nur für RES verwendet werden" },
+ { "Variable '%s' not assigned to, e.g. with a MOV statement, an ADD statement, etc.\r\n\r\nThis is probably a programming error; now it will always be zero.", "Variable '%s' nicht zugewiesen, z.B. zu einer Transfer- oder ADD-Anweisung usw.\r\n\r\nDas ist vermutlich ein Programmierungsfehler; jetzt wird sie immer Null sein." },
+ { "Variable for '%s' incorrectly assigned: %s.", "Variable für '%s' falsch zugewiesen: %s." },
+ { "Division by zero; halting simulation", "Division durch Null; Simulation gestoppt" },
+ { "!!!too long!!!", " !!!zu lang!!!" },
+ { "\n\nI/O ASSIGNMENT:\n\n", "\n\nE/A Zuweisungen:\n\n" },
+ { " Name | Type | Pin\n", " Name | Typ | Pin\n" },
+};
+static Lang LangDe = {
+ LangDeTable, sizeof(LangDeTable)/sizeof(LangDeTable[0])
+};
+#endif
+#ifdef LDLANG_ES
+static LangTable LangEsTable[] = {
+ { "Target frequency %d Hz, closest achievable is %d Hz (warning, >5%% error).", "Frecuencia Micro %d Hz, la mejor aproximación es %d Hz (aviso, >5%% error)." },
+ { "Compile successful; wrote IHEX for AVR to '%s'.\r\n\r\nRemember to set the processor configuration (fuses) correctly. This does not happen automatically.", "Compilación correcta; se escribió IHEX para AVR en '%s'.\r\n\r\nRecuerde marcar la configuración (fuses) del micro correctamente. Esto NO se hace automaticamente." },
+ { "( ) Normal", "( ) Normal" },
+ { "(/) Negated", "(/) Negado" },
+ { "(S) Set-Only", "(S) Activar" },
+ { "(R) Reset-Only", "(R) Desactivar" },
+ { "Pin on MCU", "Pata del Micro" },
+ { "Coil", "Bobina" },
+ { "Comment", "Comentario" },
+ { "Cycle Time (ms):", "Tiempo Ciclo (ms):" },
+ { "Crystal Frequency (MHz):", "Frecuencia Cristal (MHz):" },
+ { "UART Baud Rate (bps):", "Baudios UART (bps):" },
+ { "Serie (UART) will use pins %d and %d.\r\n\r\n", "Puerto Serie (UART) usará las patas %d y %d.\r\n\r\n" },
+ { "Please select a micro with a UART.\r\n\r\n", "Por favor. Seleccione un micro con UART.\r\n\r\n" },
+ { "No serial instructions (UART Send/UART Receive) are in use; add one to program before setting baud rate.\r\n\r\n", "No se han usado instrucciones (UART Enviar/UART Recibir) para el puerto serie aun; Añada una al programa antes de configurar los baudios.\r\n\r\n" },
+ { "The cycle time for the 'PLC' runtime generated by LDmicro is user-configurable. Very short cycle times may not be achievable due to processor speed constraints, and very long cycle times may not be achievable due to hardware overflows. Cycle times between 10 ms and 100 ms will usually be practical.\r\n\r\nThe compiler must know what speed crystal you are using with the micro to convert between timing in clock cycles and timing in seconds. A 4 MHz to 20 MHz crystal is typical; check the speed grade of the part you are using to determine the maximum allowable clock speed before choosing a crystal.", "El tiempo de ciclo de ejecución para el 'PLC' es configurable. Un tiempo de ciclo muy corto puede no funcionar debido a la baja velocidad del micro, y un tiempo de ciclo muy largo puede no funcionar por limitaciones del temporizador del micro. Ciclos de tiempo entre 10 y 100 ms suele ser lo normal.\r\n\r\nEl compilador debe conocer la velocidad del cristal que estas usando para poder convertir entre tiempo en ciclos de reloj y tiempo en segundos. Un cristal entre 4 Mhz y 20 Mhz es lo típico; Comprueba la velocidad a la que puede funcionar tu micro y calcula la velocidad máxima del reloj antes de elegir el cristal." },
+ { "PLC Configuration", "Configuración PLC" },
+ { "Zero cycle time not valid; resetting to 10 ms.", "No es valido un tiempo de ciclo 0; forzado a 10 ms." },
+ { "Source", "Fuente" },
+ { "Internal Relay", "Rele Interno" },
+ { "Input pin", "Pata Entrada" },
+ { "Output pin", "Pata Salida" },
+ { "|/| Negated", "|/| Negado" },
+ { "Contacts", "Contacto" },
+ { "No ADC or ADC not supported for selected micro.", "El micro seleccionado no tiene ADC o no esta soportado." },
+ { "Assign:", "Asignar:" },
+ { "No microcontroller has been selected. You must select a microcontroller before you can assign I/O pins.\r\n\r\nSelect a microcontroller under the Settings menu and try again.", "No se ha seleccionado micro. Debes seleccionar un micro antes de asignar patas E/S.\r\n\r\nElije un micro en el menu de configuración y prueba otra vez." },
+ { "I/O Pin Assignment", "Asignación de pata E/S" },
+ { "Can't specify I/O assignment for ANSI C target; compile and see comments in generated source code.", "No se puede asignar la E/S especificadas para el ANSI C generado; compile y vea los comentarios generados en el código fuente." },
+ { "Can't specify I/O assignment for interpretable target; see comments in reference implementation of interpreter.", "No se puede asignar la E/S especificadas para el código generado para el interprete; vea los comentarios en la implementación del interprete." },
+ { "Can only assign pin number to input/output pins (Xname or Yname or Aname).", "Solo puede asignar numero de pata a las patas de Entrada/Salida (Xname o Yname o Aname)." },
+ { "No ADC or ADC not supported for this micro.", "Este micro no tiene ADC o no esta soportado." },
+ { "Rename I/O from default name ('%s') before assigning MCU pin.", "Cambie el nombre por defecto ('%s') antes de asignarle una pata del micro." },
+ { "I/O Pin", "E/S Pata" },
+ { "(no pin)", "(falta pata)" },
+ { "<UART needs!>", "<Se necesita UART!>" },
+ { "<PWM needs!>", "<Se necesita PWM!>" },
+ { "<not an I/O!>", "<No es una E/S!>" },
+ { "Export As Text", "Exportar como Texto" },
+ { "Couldn't write to '%s'.", "No puedo escribir en '%s'." },
+ { "Compile To", "Compilar" },
+ { "Must choose a target microcontroller before compiling.", "Debe elegir un micro antes de compilar." },
+ { "UART function used but not supported for this micro.", "Usadas Funciones para UART. Este micro no las soporta." },
+ { "PWM function used but not supported for this micro.", "Usadas Funciones para PWM. Este micro no las soporta." },
+ { "The program has changed since it was last saved.\r\n\r\nDo you want to save the changes?", "El programa ha cambiado desde la última vez que los guardo.\r\n\r\n¿Quieres guardar los cambios?" },
+ { "--add comment here--", "--añade el comentario aquí--" },
+ { "Start new program?", "¿Empezar un nuevo programa?" },
+ { "Couldn't open '%s'.", "No puedo abrir '%s'." },
+ { "Name", "Nombre" },
+ { "State", "Estado" },
+ { "Pin on Processor", "Pata del Micro" },
+ { "MCU Port", "Puerto del Micro" },
+ { "LDmicro - Simulation (Running)", "LDmicro - Simulación (Ejecutando)" },
+ { "LDmicro - Simulation (Stopped)", "LDmicro - Simulación (Parada)" },
+ { "LDmicro - Program Editor", "LDmicro – Editor de Programa" },
+ { " - (not yet saved)", " - (no guardado aún)" },
+ { "&New\tCtrl+N", "&Nuevo\tCtrl+N" },
+ { "&Open...\tCtrl+O", "&Abrir...\tCtrl+O" },
+ { "&Save\tCtrl+S", "&Guardar\tCtrl+S" },
+ { "Save &As...", "Guardar &Como..." },
+ { "&Export As Text...\tCtrl+E", "&Exportar a Texto...\tCtrl+E" },
+ { "E&xit", "&Salir" },
+ { "&Undo\tCtrl+Z", "&Deshacer\tCtrl+Z" },
+ { "&Redo\tCtrl+Y", "&Rehacer\tCtrl+Y" },
+ { "Insert Rung &Before\tShift+6", "Insertar Línea (Rung) &Antes\tShift+6" },
+ { "Insert Rung &After\tShift+V", "Insertar Línea (Rung) &Despues\tShift+V" },
+ { "Move Selected Rung &Up\tShift+Up", "Subir Línea (Rung) Seleccionada\tShift+Up" },
+ { "Move Selected Rung &Down\tShift+Down", "Bajar Línea (Rung) Seleccionada\tShift+Down" },
+ { "&Delete Selected Element\tDel", "&Borrar Elemento Seleccionado\tSupr" },
+ { "D&elete Rung\tShift+Del", "B&orrar Línea (Rung) Seleccionada\tShift+Supr" },
+ { "Insert Co&mment\t;", "Insertar Co&mentario\t;" },
+ { "Insert &Contacts\tC", "Insertar &Contacto\tC" },
+ { "Insert OSR (One Shot Rising)\t&/", "Insertar OSR (Flanco de Subida)\t&/" },
+ { "Insert OSF (One Shot Falling)\t&\\", "Insertar OSF (Flanco de Bajada)\t&\\" },
+ { "Insert T&ON (Delayed Turn On)\tO", "Insertar T&ON (Encendido Retardado)\tO" },
+ { "Insert TO&F (Delayed Turn Off)\tF", "Insertar TO&F (Apagado Retardado)\tF" },
+ { "Insert R&TO (Retentive Delayed Turn On)\tT", "Insertar R&TO (Encendido Retardado con Memoria)\tT" },
+ { "Insert CT&U (Count Up)\tU", "Insertar CT&U (Contador Incremental)\tU" },
+ { "Insert CT&D (Count Down)\tI", "Insertar CT&D (Contador Decremental)\tI" },
+ { "Insert CT&C (Count Circular)\tJ", "Insertar CT&C (Contador Circular)\tJ" },
+ { "Insert EQU (Compare for Equals)\t=", "Insertar EQU (Comparador si Igual)\t=" },
+ { "Insert NEQ (Compare for Not Equals)", "Insertar NEQ (Comparador si NO Igual)" },
+ { "Insert GRT (Compare for Greater Than)\t>", "Insertar GRT (Comparador si Mayor que)\t>" },
+ { "Insert GEQ (Compare for Greater Than or Equal)\t.", "Insertar GEQ (Comparador si Mayor o Igual que)\t." },
+ { "Insert LES (Compare for Less Than)\t<", "Insertar LES (Comparador si Menor que)\t<" },
+ { "Insert LEQ (Compare for Less Than or Equal)\t,", "Insertar LEQ (Comparador si Menor o Igual que)\t," },
+ { "Insert Open-Circuit", "Insertar Circuito-Abierto" },
+ { "Insert Short-Circuit", "Insertar Circuito-Cerrado" },
+ { "Insert Master Control Relay", "Insertar Rele de Control Maestro" },
+ { "Insert Coi&l\tL", "Insertar &Bobina\tL" },
+ { "Insert R&ES (Counter/RTO Reset)\tE", "Insertar R&ES (Contador/RTO Reinicio)\tE" },
+ { "Insert MOV (Move)\tM", "Insertar MOV (Mover)\tM" },
+ { "Insert ADD (16-bit Integer Add)\t+", "Insertar ADD (Suma Entero 16-bit)\t+" },
+ { "Insert SUB (16-bit Integer Subtract)\t-", "Insertar SUB (Resta Entero 16-bit)\t-" },
+ { "Insert MUL (16-bit Integer Multiply)\t*", "Insertar MUL (Multiplica Entero 16-bit)\t*" },
+ { "Insert DIV (16-bit Integer Divide)\tD", "Insertar DIV (Divide Entero 16-bit)\tD" },
+ { "Insert Shift Register", "Insertar Registro de Desplazamiento" },
+ { "Insert Look-Up Table", "Insertar Tabla de Busqueda" },
+ { "Insert Piecewise Linear", "Insertar Linealización por Segmentos" },
+ { "Insert Formatted String Over UART", "Insertar Cadena Formateada en la UART" },
+ { "Insert &UART Send", "Insertar &UART Enviar" },
+ { "Insert &UART Receive", "Insertar &UART Recibir" },
+ { "Insert Set PWM Output", "Insertar Valor Salida PWM" },
+ { "Insert A/D Converter Read\tP", "Insertar Lectura Conversor A/D\tP" },
+ { "Insert Make Persistent", "Insertar Hacer Permanente" },
+ { "Make Norm&al\tA", "Hacer Norm&al\tA" },
+ { "Make &Negated\tN", "Hacer &Negado\tN" },
+ { "Make &Set-Only\tS", "Hacer &Solo-Activar\tS" },
+ { "Make &Reset-Only\tR", "Hace&r Solo-Desactivar\tR" },
+ { "&MCU Parameters...", "&Parametros del Micro..." },
+ { "(no microcontroller)", "(no microcontrolador)" },
+ { "&Microcontroller", "&Microcontrolador" },
+ { "Si&mulation Mode\tCtrl+M", "Modo Si&mulación \tCtrl+M" },
+ { "Start &Real-Time Simulation\tCtrl+R", "Empezar Simulación en Tiempo &Real\tCtrl+R" },
+ { "&Halt Simulation\tCtrl+H", "Parar Simulación\tCtrl+H" },
+ { "Single &Cycle\tSpace", "Solo un &Ciclo\tSpace" },
+ { "&Compile\tF5", "&Compilar\tF5" },
+ { "Compile &As...", "Compilar &Como..." },
+ { "&Manual...\tF1", "&Manual...\tF1" },
+ { "&About...", "&Acerca de..." },
+ { "&File", "&Archivo" },
+ { "&Edit", "&Editar" },
+ { "&Settings", "&Configuraciones" },
+ { "&Instruction", "&Instrucción" },
+ { "Si&mulate", "Si&mular" },
+ { "&Compile", "&Compilar" },
+ { "&Help", "&Ayuda" },
+ { "no MCU selected", "micro no seleccionado" },
+ { "cycle time %.2f ms", "tiempo ciclo %.2f ms" },
+ { "processor clock %.4f MHz", "reloj procesador %.4f MHz" },
+ { "Internal error relating to PIC paging; make program smaller or reshuffle it.", "Error interno relativo a la paginación del PIC; Haz el programa mas pequeño o reorganizalo" },
+ { "PWM frequency too fast.", "Frecuencia del PWM demasiado alta." },
+ { "PWM frequency too slow.", "Frecuencia del PWM demasiado baja." },
+ { "Cycle time too fast; increase cycle time, or use faster crystal.", "Tiempo del Ciclo demasiado rapido; aumenta el tiempo de ciclo, o usa un cristal de mas Mhz." },
+ { "Cycle time too slow; decrease cycle time, or use slower crystal.", "Tiempo del Ciclo demasiado lento; incrementa el tiempo de ciclo, o usa un cristal de menos Mhz." },
+ { "Couldn't open file '%s'", "No puedo abrir el archivo '%s'" },
+ { "Zero baud rate not possible.", "Cero baudios no es posible." },
+ { "Compile successful; wrote IHEX for PIC16 to '%s'.\r\n\r\nConfiguration word (fuses) has been set for crystal oscillator, BOD enabled, LVP disabled, PWRT enabled, all code protection off.\r\n\r\nUsed %d/%d words of program flash (chip %d%% full).", "Compilación correcta; escrito IHEX para PIC16 en '%s'.\r\n\r\nBits de Configurarión (fuses) han sido establecidos para oscilador a cristal, BOD activado, LVP desactivado, PWRT activado, Todos los bits de protección desactivados.\r\n\r\nUsadas %d/%d palabras de programa en flash (Chip %d%% lleno)." },
+ { "Type", "Tipo" },
+ { "Timer", "Temporizador" },
+ { "Counter", "Contador" },
+ { "Reset", "Reiniciar" },
+ { "OK", "OK" },
+ { "Cancel", "Cancelar" },
+ { "Empty textbox; not permitted.", "Texto vacio; no permitido" },
+ { "Bad use of quotes: <%s>", "Mal uso de las comillas: <%s>" },
+ { "Turn-On Delay", "Activar Retardado" },
+ { "Turn-Off Delay", "Desactivar Retardado" },
+ { "Retentive Turn-On Delay", "Activar Retardado con Memoria" },
+ { "Delay (ms):", "Retardo (ms):" },
+ { "Delay too long; maximum is 2**31 us.", "Retardo demasiado largo; maximo 2**31 us." },
+ { "Delay cannot be zero or negative.", "El retardo no puede ser cero o negativo." },
+ { "Count Up", "Contador Creciente" },
+ { "Count Down", "Contador Decreciente" },
+ { "Circular Counter", "Contador Circular" },
+ { "Max value:", "Valor Max:" },
+ { "True if >= :", "Verdad si >= :" },
+ { "If Equals", "Si igual" },
+ { "If Not Equals", "Si NO igual" },
+ { "If Greater Than", "Si mayor que" },
+ { "If Greater Than or Equal To", "Si mayor o igual que" },
+ { "If Less Than", "Si menor que" },
+ { "If Less Than or Equal To", "Si menor o igual que" },
+ { "'Closed' if:", "'Cerrado' si:" },
+ { "Move", "Mover" },
+ { "Read A/D Converter", "Leer Conversor A/D" },
+ { "Duty cycle var:", "Var Ancho Ciclo:" },
+ { "Frequency (Hz):", "Frecuencia (Hz):" },
+ { "Set PWM Duty Cycle", "Poner Ancho de Pulso PWM" },
+ { "Source:", "Fuente:" },
+ { "Receive from UART", "Recibido en la UART" },
+ { "Send to UART", "Enviado a la UART" },
+ { "Add", "Sumar" },
+ { "Subtract", "Restar" },
+ { "Multiply", "Multiplicar" },
+ { "Divide", "Dividir" },
+ { "Destination:", "Destino:" },
+ { "is set := :", "esta puesto := :" },
+ { "Name:", "Nombre:" },
+ { "Stages:", "Fases:" },
+ { "Shift Register", "Registro Desplazamiento" },
+ { "Not a reasonable size for a shift register.", "No es un tamaño razonable para el Registro de Desplazamiento." },
+ { "String:", "Cadena:" },
+ { "Formatted String Over UART", "Cadena Formateada para UART" },
+ { "Variable:", "Variable:" },
+ { "Make Persistent", "Hacer permanente" },
+ { "Too many elements in subcircuit!", "Demasiados elementos en un SubCircuito!" },
+ { "Too many rungs!", "Demasiadas Lineas (rungs)!" },
+ { "Error", "Error" },
+ { "ANSI C target does not support peripherals (UART, PWM, ADC, EEPROM). Skipping that instruction.", "ANSI C de destino no soporta perifericos (UART, PWM, ADC, EEPROM). Evite esa instrucción." },
+ { "Compile successful; wrote C source code to '%s'.\r\n\r\nThis is not a complete C program. You have to provide the runtime and all the I/O routines. See the comments in the source code for information about how to do this.", "Compilación correcta: Escrito Código Fuente en C en '%s'.\r\n\r\nNo es un programa completo en C. Tiene que añadirle el procedimiento principal y todas las rutinas de E/S. Vea los comentarios en el código fuente para mas información sobre como hacer esto" },
+ { "Cannot delete rung; program must have at least one rung.", "No puedo borrar la Linea (rung); el programa debe tener al menos una Linea (rung)." },
+ { "Out of memory; simplify program or choose microcontroller with more memory.", "Fuera de Memoria; Simplifique el programa o elija un micro con mas memoria.." },
+ { "Must assign pins for all ADC inputs (name '%s').", "Debe asignar patas para todas las entradas del ADC (nombre '%s')." },
+ { "Internal limit exceeded (number of vars)", "Limite interno superado (numero de variables)" },
+ { "Internal relay '%s' never assigned; add its coil somewhere.", "No ha asignado el rele interno '%s'; añada la bobina en cualquier parte del programa." },
+ { "Must assign pins for all I/O.\r\n\r\n'%s' is not assigned.", "Debe asignar patas a todas las E/S.\r\n\r\n'%s' no esta asignada." },
+ { "UART in use; pins %d and %d reserved for that.", "UART en uso; patas %d y %d reservadas para eso." },
+ { "PWM in use; pin %d reserved for that.", "PWM en uso; pata %d reservada para eso." },
+ { "UART baud rate generator: divisor=%d actual=%.4f for %.2f%% error.\r\n\r\nThis is too large; try a different baud rate (slower probably), or a crystal frequency chosen to be divisible by many common baud rates (e.g. 3.6864 MHz, 14.7456 MHz).\r\n\r\nCode will be generated anyways but serial may be unreliable or completely broken.", "UART generador de baudios: divisor=%d actual=%.4f para %.2f%% error.\r\n\r\nEs demasiado grande; Prueba con otro valor de baudios (probablemente menor), o un cristal cuya frecuencia sea divible por los baudios mas comunes (p.e. 3.6864MHz, 14.7456MHz).\r\n\r\nEl código se genera de todas formas pero las tramas serie sean inestable o no entendible." },
+ { "UART baud rate generator: too slow, divisor overflows. Use a slower crystal or a faster baud rate.\r\n\r\nCode will be generated anyways but serial will likely be completely broken.", "UART generador de baudios: demasiado lento, divisor demasiado grande. Use un cristal mas lento o mayor baudios.\r\n\r\nEl código se genera de todas formas pero las tramas serie serán no entendible.." },
+ { "Couldn't open '%s'\n", "No puedo abrir '%s'\n" },
+ { "Timer period too short (needs faster cycle time).", "Periodo de Tiempo demasiado corto (se necesita un tiempo de ciclo menor)." },
+ { "Timer period too long (max 32767 times cycle time); use a slower cycle time.", "Periodo del temporizador demasiado largo (max. 32767 veces el tiempo de ciclo); use un tiempo de ciclo mayor." },
+ { "Constant %d out of range: -32768 to 32767 inclusive.", "Constante %d fuera de rango: -32768 a 32767 inclusive." },
+ { "Move instruction: '%s' not a valid destination.", "Instrucción Move: '%s' no es valido el destino." },
+ { "Math instruction: '%s' not a valid destination.", "Instrucción Math: '%s' no es valido el destino." },
+ { "Piecewise linear lookup table with zero elements!", "tabla de linealizacion por segmentos con cero elementos!" },
+ { "x values in piecewise linear table must be strictly increasing.", "Los valores X en la tabla de linealización por segmentos deben ser estrictamente incrementales." },
+ { "Numerical problem with piecewise linear lookup table. Either make the table entries smaller, or space the points together more closely.\r\n\r\nSee the help file for details.", "Problema numérico con la tabla de linealización por segmentos. Haz la tabla de entradas mas pequeña, o aleja mas los puntos juntos.\r\n\r\nMira la ayuda para mas detalles." },
+ { "Multiple escapes (\\0-9) present in format string, not allowed.", "No esta permitido mas de un caracter especial (\\0-9) dentro de la cadena de caractares." },
+ { "Bad escape: correct form is \\xAB.", "Caracter Especial Erroneo: la forma correcta es = \\xAB." },
+ { "Bad escape '\\%c'", "Caracter Especial Erroneo '\\%c'" },
+ { "Variable is interpolated into formatted string, but none is specified.", "Se ha declarado un parametro dentro la cadena de caracteres, pero falta especificar la variable." },
+ { "No variable is interpolated into formatted string, but a variable name is specified. Include a string like '\\-3', or leave variable name blank.", "No se ha declarado un parametro dentro de la cadena de caractares pero sin embargo se ha especificado una variable. Añada un cadena como '\\-3', o quite el nombre de la variable." },
+ { "Empty row; delete it or add instructions before compiling.", "Fila vacia; borrela o añada instrucciones antes de compilar." },
+ { "Couldn't write to '%s'", "No puedo escribir en '%s'." },
+ { "Unsupported op (anything ADC, PWM, UART, EEPROM) for interpretable target.", "Op no soportada en el interprete (algun ADC, PWM, UART, EEPROM)." },
+ { "Compile successful; wrote interpretable code to '%s'.\r\n\r\nYou probably have to adapt the interpreter to your application. See the documentation.", "Compilación correcta: Código para interprete escrito en '%s'.\r\n\r\nProblablemente tengas que adaptar el interprete a tu aplicación. Mira la documentación." },
+ { "Microcontroller '%s' not supported.\r\n\r\nDefaulting to no selected MCU.", "Microcontrolador '%s' no sorportado.\r\n\r\nForzando ninguna CPU." },
+ { "File format error; perhaps this program is for a newer version of LDmicro?", "Error en el formato de archivo; quizas este programa es una version mas moderna de LDmicro?." },
+ { "Index:", "Indice:" },
+ { "Points:", "Puntos:" },
+ { "Count:", "Cantidad:" },
+ { "Edit table of ASCII values like a string", "Editar tabla de valores ascii como una cadena" },
+ { "Look-Up Table", "Buscar en Tabla" },
+ { "Piecewise Linear Table", "Tabla de linealización por segmentos" },
+ { "LDmicro Error", "LDmicro Error" },
+ { "Compile Successful", "Compilación Correcta" },
+ { "digital in", "entrada digital" },
+ { "digital out", "salida digital" },
+ { "int. relay", "rele interno" },
+ { "UART tx", "UART tx" },
+ { "UART rx", "UART rx" },
+ { "PWM out", "salida PWM" },
+ { "turn-on delay", "activar retardo" },
+ { "turn-off delay", "desactivar retardo" },
+ { "retentive timer", "temporizador con memoria" },
+ { "counter", "contador" },
+ { "general var", "var general" },
+ { "adc input", "entrada adc" },
+ { "<corrupt!>", "<estropeado!>" },
+ { "(not assigned)", "(no asignado)" },
+ { "<no UART!>", "<no UART!>" },
+ { "<no PWM!>", "<no PWM!>" },
+ { "TOF: variable cannot be used elsewhere", "TOF: la variable no puede ser usada en otra parte" },
+ { "TON: variable cannot be used elsewhere", "TON: la variable no puede ser usada en otra parte" },
+ { "RTO: variable can only be used for RES elsewhere", "RTO: la variable solo puede ser usada como RES en otra parte" },
+ { "Variable '%s' not assigned to, e.g. with a MOV statement, an ADD statement, etc.\r\n\r\nThis is probably a programming error; now it will always be zero.", "Variable '%s' no asignada, p.e. con el comando MOV, una instrucción ADD, etc.\r\n\r\nEsto es probablemente un error de programación; valdrá cero." },
+ { "Variable for '%s' incorrectly assigned: %s.", "Variable para '%s' incorrectamente asignada: %s." },
+ { "Division by zero; halting simulation", "División por cero; Parando simulación" },
+ { "!!!too long!!!", "!!Muy grande!!" },
+ { "\n\nI/O ASSIGNMENT:\n\n", "\n\nE/S ASIGNACIÓN:\n\n" },
+ { " Name | Type | Pin\n", " Nombre | Tipo | Pata\n" },
+ { "Serial (UART) will use pins %d and %d.\r\n\r\n", "El Puerto Serie (UART) usará los pines %d y %d.\r\n\r\n" },
+};
+static Lang LangEs = {
+ LangEsTable, sizeof(LangEsTable)/sizeof(LangEsTable[0])
+};
+#endif
+#ifdef LDLANG_FR
+static LangTable LangFrTable[] = {
+ { "Target frequency %d Hz, closest achievable is %d Hz (warning, >5%% error).", "Fréquence de la cible %d Hz, fonction accomplie à %d Hz (ATTENTION, >5% erreur)." },
+ { "Compile successful; wrote IHEX for AVR to '%s'.\r\n\r\nRemember to set the processor configuration (fuses) correctly. This does not happen automatically.", "Compilé avec succès. Ecriture du fichier IHEX pour AVR sous '%s'.\r\n\r\nVous devez configurer manuellement les Bits de configuration (fusibles). Ceci n'est pas accompli automatiquement." },
+ { "( ) Normal", "( ) Normal" },
+ { "(/) Negated", "(/) Inversée" },
+ { "(S) Set-Only", "(S) Activer" },
+ { "(R) Reset-Only", "(R) RAZ" },
+ { "Pin on MCU", "Broche MCU" },
+ { "Coil", "Bobine" },
+ { "Comment", "Commentaire" },
+ { "Cycle Time (ms):", "Temps de cycle (ms):" },
+ { "Crystal Frequency (MHz):", "Fréquence quartz (MHz):" },
+ { "UART Baud Rate (bps):", "UART Vitesse (bps):" },
+ { "Serial (UART) will use pins %d and %d.\r\n\r\n", "Communication série utilisera broches %d et %d.\r\n\r\n" },
+ { "Please select a micro with a UART.\r\n\r\n", "Sélectionnez un processeur avec UART.\r\n\r\n" },
+ { "No serial instructions (UART Send/UART Receive) are in use; add one to program before setting baud rate.\r\n\r\n", "Aucune instruction (émission ou réception UART) n'est utilisée; ajouter une instruction avant de fixer les vitesses.\r\n\r\n" },
+ { "The cycle time for the 'PLC' runtime generated by LDmicro is user-configurable. Very short cycle times may not be achievable due to processor speed constraints, and very long cycle times may not be achievable due to hardware overflows. Cycle times between 10 ms and 100 ms will usually be practical.\r\n\r\nThe compiler must know what speed crystal you are using with the micro to convert between timing in clock cycles and timing in seconds. A 4 MHz to 20 MHz crystal is typical; check the speed grade of the part you are using to determine the maximum allowable clock speed before choosing a crystal.", "Le temps de cycle de l'API (automate programmable) est configurable par l'utilisateur. Un temps trop court n'est pas utilisable dû à des contraintes de vitesse du processeur. Des temps de cycle trop longs ne sont pas utilisables à cause du dépassement de capacité des registres. Des temps de cycle compris entre 10 ms et 100 ms sont géneralement utilisables.\r\n\r\nLe compilateur doit connaitre la fréquence du quartz utilisé pour définir les temps de cycles d'horloge ainsi que les temporisations, les fréquences de 4 à 20 mhz sont typiques. Déterminer la vitesse désirée avant de choisir le quartz." },
+ { "PLC Configuration", "Configuration API" },
+ { "Zero cycle time not valid; resetting to 10 ms.", "Temps de cycle non valide ; remis à 10 ms." },
+ { "Source", "Source" },
+ { "Internal Relay", "Relais interne" },
+ { "Input pin", "Entrée" },
+ { "Output pin", "Sortie" },
+ { "|/| Negated", "|/| Normalement fermé" },
+ { "Contacts", "Contacts" },
+ { "No ADC or ADC not supported for selected micro.", "Pas de convertisseur A/D ou convertisseur non supporté pour le MCU sélectionné." },
+ { "Assign:", "Affectations:" },
+ { "No microcontroller has been selected. You must select a microcontroller before you can assign I/O pins.\r\n\r\nSelect a microcontroller under the Settings menu and try again.", "Aucun microcontrolleur sélectionné. Vous devez sélectionner un microcontroleur avant de définir l'utilisation des broches.\r\n\r\nSélectionnez un micro dans le menu et essayez à nouveau." },
+ { "I/O Pin Assignment", "Affectation broches E/S" },
+ { "Can't specify I/O assignment for ANSI C target; compile and see comments in generated source code.", "Ne pas spécifier les E/S pour code en ANSI C; Compiler et voir les commentaires dans le code source généré." },
+ { "Can't specify I/O assignment for interpretable target; see comments in reference implementation of interpreter.", "Ne pas spécifier les E/S pour sortie en code interprété; Voir les commentaires pour l'implémentation de l'interpréteur ." },
+ { "Can only assign pin number to input/output pins (Xname or Yname or Aname).", "Vous pouvez uniquement affecter les broches Entrées/Sorties (XName , YName ou AName)." },
+ { "No ADC or ADC not supported for this micro.", "Pas de convertisseur A/D ou convertisseur non supporté pour ce micro." },
+ { "Rename I/O from default name ('%s') before assigning MCU pin.", "Changer les noms par défauts des E/S ('%s') avant de leur affecter une broche MCU." },
+ { "I/O Pin", "Broches E/S" },
+ { "(no pin)", "(Aucune broche)" },
+ { "<UART needs!>", "<UART nécessaire!>" },
+ { "<PWM needs!>", "<PWM nécessaire!>" },
+ { "<not an I/O!>", "<Pas une E/S!>" },
+ { "Export As Text", "Exporter en texte" },
+ { "Couldn't write to '%s'.", "Impossible d'écrire '%s'." },
+ { "Compile To", "Compiler sous" },
+ { "Must choose a target microcontroller before compiling.", "Choisir un microcontrolleur avant de compiler." },
+ { "UART function used but not supported for this micro.", "Des fonctions UART sont utilisées, mais non supportées par ce micro." },
+ { "PWM function used but not supported for this micro.", "Fonctions PWM utilisées mais non supportées par ce micro." },
+ { "The program has changed since it was last saved.\r\n\r\nDo you want to save the changes?", "Le programme a changé depuis la dernière sauvegarde.\r\n\r\nVoulez-vous sauvegarder les changements?" },
+ { "--add comment here--", "--Ajouter les commentaires ICI--" },
+ { "Start new program?", "Commencer un nouveau programme?" },
+ { "Couldn't open '%s'.", "Impossible d'ouvrir '%s'." },
+ { "Name", "Nom" },
+ { "State", "Etat" },
+ { "Pin on Processor", "Broche du Micro" },
+ { "MCU Port", "Port du processeur" },
+ { "LDmicro - Simulation (Running)", "LDmicro - Simulation (en cours)" },
+ { "LDmicro - Simulation (Stopped)", "LDmicro - Simulation (Arrétée)" },
+ { "LDmicro - Program Editor", "LDmicro – Edition du programme " },
+ { " - (not yet saved)", " - (fichier non sauvegardé)" },
+ { "&New\tCtrl+N", "&Nouveau\tCtrl+N" },
+ { "&Open...\tCtrl+O", "&Ouvrir...\tCtrl+O" },
+ { "&Save\tCtrl+S", "&Sauvegarder\tCtrl+S" },
+ { "Save &As...", "S&auvegarder sous..." },
+ { "&Export As Text...\tCtrl+E", "&Exporter en texte...\tCtrl+E" },
+ { "E&xit", "Quitter" },
+ { "&Undo\tCtrl+Z", "Annuler\tCtrl+Z" },
+ { "&Redo\tCtrl+Y", "&Refaire\tCtrl+Y" },
+ { "Insert Rung &Before\tShift+6", "Insérer ligne avant\tShift+6" },
+ { "Insert Rung &After\tShift+V", "Insérer ligne &après\tShift+V" },
+ { "Move Selected Rung &Up\tShift+Up", "Déplacer la ligne sélectionnée au dessus\tShift+Up" },
+ { "Move Selected Rung &Down\tShift+Down", "Déplacer la ligne sélectionnée au dessous\tShift+Down" },
+ { "&Delete Selected Element\tDel", "&Effacer l'élement sélectionné\tSuppr" },
+ { "D&elete Rung\tShift+Del", "Supprimer la ligne\tShift+Suppr" },
+ { "Insert Co&mment\t;", "Insérer commentaire\t;" },
+ { "Insert &Contacts\tC", "Insérer &contact\tC" },
+ { "Insert OSR (One Shot Rising)\t&/", "Insérer OSR (Front montant)\t&/" },
+ { "Insert OSF (One Shot Falling)\t&\\", "Insérer OSF (Front descendant)\t&\\" },
+ { "Insert T&ON (Delayed Turn On)\tO", "Insérer T&ON (Tempo travail)\tO" },
+ { "Insert TO&F (Delayed Turn Off)\tF", "Insérer TO&F (Tempo repos)\tF" },
+ { "Insert R&TO (Retentive Delayed Turn On)\tT", "Insérer R&TO (Tempo totalisatrice)\tT" },
+ { "Insert CT&U (Count Up)\tU", "Insérer CT&U (Compteur)\tU" },
+ { "Insert CT&D (Count Down)\tI", "Insérer CT&D (Décompteur)\tI" },
+ { "Insert CT&C (Count Circular)\tJ", "Insérer CT&C (Compteur cyclique)\tJ" },
+ { "Insert EQU (Compare for Equals)\t=", "Insérer EQU (Compare pour égalité)\t=" },
+ { "Insert NEQ (Compare for Not Equals)", "Insérer NEQ (Compare pour inégalité)" },
+ { "Insert GRT (Compare for Greater Than)\t>", "Insérer GRT (Compare plus grand que)\t>" },
+ { "Insert GEQ (Compare for Greater Than or Equal)\t.", "Insérer GEQ (Compare plus grand ou égal à)\t." },
+ { "Insert LES (Compare for Less Than)\t<", "Insérer LES (Compare plus petit que)\t<" },
+ { "Insert LEQ (Compare for Less Than or Equal)\t,", "Insérer LEQ (Compare plus petit ou égal à)\t," },
+ { "Insert Open-Circuit", "Insérer circuit ouvert" },
+ { "Insert Short-Circuit", "Insérer court circuit" },
+ { "Insert Master Control Relay", "Insérer relais de contrôle maitre" },
+ { "Insert Coi&l\tL", "Insérer bobine re&lais \tL" },
+ { "Insert R&ES (Counter/RTO Reset)\tE", "Insérer R&ES (Remise à zéro RTO/compteur)\tE" },
+ { "Insert MOV (Move)\tM", "Insérer MOV (Mouvoir)\tM" },
+ { "Insert ADD (16-bit Integer Add)\t+", "Insérer ADD (Addition entier 16-bit)\t+" },
+ { "Insert SUB (16-bit Integer Subtract)\t-", "Insérer SUB (Soustraction entier 16-bit)\t-" },
+ { "Insert MUL (16-bit Integer Multiply)\t*", "Insérer MUL (Multiplication entier 16-bit)\t*" },
+ { "Insert DIV (16-bit Integer Divide)\tD", "Insérer DIV (Division entier 16-bit)\tD" },
+ { "Insert Shift Register", "Insérer registre à décalage" },
+ { "Insert Look-Up Table", "Insérer tableau indexé" },
+ { "Insert Piecewise Linear", "Insérer tableau d'éléments linéaires" },
+ { "Insert Formatted String Over UART", "Insérer chaine formattée pour l'UART" },
+ { "Insert &UART Send", "Insérer émission &UART" },
+ { "Insert &UART Receive", "Insérer réception &UART" },
+ { "Insert Set PWM Output", "Insérer fixer sortie PWM" },
+ { "Insert A/D Converter Read\tP", "Insérer lecture convertisseur A/D\tP" },
+ { "Insert Make Persistent", "Insérer mettre rémanent" },
+ { "Make Norm&al\tA", "Mettre norm&al\tA" },
+ { "Make &Negated\tN", "I&nverser\tN" },
+ { "Make &Set-Only\tS", "Activer uniquement\tS" },
+ { "Make &Reset-Only\tR", "Faire RAZ uniquement\tR" },
+ { "&MCU Parameters...", "&Paramètres MCU..." },
+ { "(no microcontroller)", "(pas de microcontrolleur)" },
+ { "&Microcontroller", "&Microcontrolleur" },
+ { "Si&mulation Mode\tCtrl+M", "Mode si&mulation\tCtrl+M" },
+ { "Start &Real-Time Simulation\tCtrl+R", "Commencer la simulation en temps &réel\tCtrl+R" },
+ { "&Halt Simulation\tCtrl+H", "&Arrêter la simulation\tCtrl+H" },
+ { "Single &Cycle\tSpace", "&Cycle unique\tEspace" },
+ { "&Compile\tF5", "&Compiler\tF5" },
+ { "Compile &As...", "Compiler sous..." },
+ { "&Manual...\tF1", "&Manuel...\tF1" },
+ { "&About...", "&A propos..." },
+ { "&File", "&Fichier" },
+ { "&Edit", "&Edition" },
+ { "&Settings", "&Paramètres" },
+ { "&Instruction", "&Instruction" },
+ { "Si&mulate", "Si&mulation" },
+ { "&Compile", "&Compilation" },
+ { "&Help", "&Aide" },
+ { "no MCU selected", "pas de MCU sélectionné" },
+ { "cycle time %.2f ms", "cycle %.2f ms" },
+ { "processor clock %.4f MHz", "horloge processeur %.4f MHz" },
+ { "Internal error relating to PIC paging; make program smaller or reshuffle it.", "Erreur interne dans l'utilisation des pages du PIC; Diminuer le programme ou le remanier" },
+ { "PWM frequency too fast.", "Fréquence PWM trop rapide." },
+ { "PWM frequency too slow.", "Frequence PWM trop lente." },
+ { "Cycle time too fast; increase cycle time, or use faster crystal.", "Temps cycle trop court; augmenter le temps de cycle ou utiliser un quartz plus rapide." },
+ { "Cycle time too slow; decrease cycle time, or use slower crystal.", "Temps de cycle trop long ; Diminuer le temps de cycle ou la fréquence du quartz ." },
+ { "Couldn't open file '%s'", "Impossible d'ouvrir le fichier '%s'" },
+ { "Zero baud rate not possible.", "Vitesse transmission = 0 : impossible" },
+ { "Compile successful; wrote IHEX for PIC16 to '%s'.\r\n\r\nConfiguration word (fuses) has been set for crystal oscillator, BOD enabled, LVP disabled, PWRT enabled, all code protection off.\r\n\r\nUsed %d/%d words of program flash (chip %d%% full).", "Compilé avec succès; Ecriture IHEX pour PIC16 sous '%s'.\r\n\r\nLes bits de configuration (fuse) : Oscillateur quartz, BOD activé, LVP déactivé, PWRT activé, sans code de protection.\r\n\r\nUtilise %d/%d mots du programme flash (Chip %d%% au total)." },
+ { "Type", "Type" },
+ { "Timer", "Temporisation" },
+ { "Counter", "Compteur" },
+ { "Reset", "RAZ" },
+ { "OK", "OK" },
+ { "Cancel", "Annuler" },
+ { "Empty textbox; not permitted.", "Zone de texte vide; interdite" },
+ { "Bad use of quotes: <%s>", "Utilisation incorrecte des guillemets: <%s>" },
+ { "Turn-On Delay", "Tempo travail" },
+ { "Turn-Off Delay", "Tempo repos" },
+ { "Retentive Turn-On Delay", "Temporisation totalisatrice" },
+ { "Delay (ms):", "Temps (ms):" },
+ { "Delay too long; maximum is 2**31 us.", "Temps trop long; maximum 2**31 us." },
+ { "Delay cannot be zero or negative.", "Tempo ne peut être à ZERO ou NEGATIF." },
+ { "Count Up", "Compteur" },
+ { "Count Down", "Décompteur" },
+ { "Circular Counter", "Compteur cyclique" },
+ { "Max value:", "Valeur max.:" },
+ { "True if >= :", "Vrai si >= :" },
+ { "If Equals", "Si EGAL" },
+ { "If Not Equals", "Si non EGAL à" },
+ { "If Greater Than", "Si plus grand que" },
+ { "If Greater Than or Equal To", "Si plus grand ou égal à" },
+ { "If Less Than", "Si plus petit que" },
+ { "If Less Than or Equal To", "Si plus petit ou égal à" },
+ { "'Closed' if:", "'Fermé' si:" },
+ { "Move", "Mouvoir" },
+ { "Read A/D Converter", "Lecture du convertisseur A/D" },
+ { "Duty cycle var:", "Utilisation:" },
+ { "Frequency (Hz):", "Frequence (Hz):" },
+ { "Set PWM Duty Cycle", "Fixer le rapport de cycle PWM" },
+ { "Source:", "Source:" },
+ { "Receive from UART", "Reception depuis l'UART" },
+ { "Send to UART", "Envoyer vers l'UART" },
+ { "Add", "Addition" },
+ { "Subtract", "Soustraction" },
+ { "Multiply", "Multiplication" },
+ { "Divide", "Division" },
+ { "Destination:", "Destination:" },
+ { "is set := :", "Valeur := :" },
+ { "Name:", "Nom:" },
+ { "Stages:", "Etapes:" },
+ { "Shift Register", "Registre à décalage" },
+ { "Not a reasonable size for a shift register.", "N'est pas une bonne taille pour un registre à décalage." },
+ { "String:", "Chaine:" },
+ { "Formatted String Over UART", "Chaine formatée pour l'UART" },
+ { "Variable:", "Variable:" },
+ { "Make Persistent", "Mettre rémanent" },
+ { "Too many elements in subcircuit!", "Trop d'éléments dans le circuit secondaire !" },
+ { "Too many rungs!", "Trop de séquences!" },
+ { "Error", "Erreur" },
+ { "ANSI C target does not support peripherals (UART, PWM, ADC, EEPROM). Skipping that instruction.", "La sortie en code ANSI C ne supporte pas les périphériques (UART, ADC, EEPROM). Ne pas utiliser ces instructions." },
+ { "Compile successful; wrote C source code to '%s'.\r\n\r\nThis is not a complete C program. You have to provide the runtime and all the I/O routines. See the comments in the source code for information about how to do this.", "Compilé avec succès; Le code source C enregistré sous '%s'.\r\n\r\nCe programme n'est pas complet. Vous devez prévoir le runtime ainsi que toutes les routines d'entrées/sorties. Voir les commentaires pour connaitre la façon de procéder." },
+ { "Cannot delete rung; program must have at least one rung.", "Impossible de supprimer la ligne, le programme doit avoir au moins une ligne." },
+ { "Out of memory; simplify program or choose microcontroller with more memory.", "Mémoire insuffisante; simplifiez le programme ou utiliser un controleur avec plus de mémoire." },
+ { "Must assign pins for all ADC inputs (name '%s').", "Vous devez spécifier une broche pour toutes les entrées ADC (nom '%s')." },
+ { "Internal limit exceeded (number of vars)", "Vous dépassez la limite interne du nombre de variables" },
+ { "Internal relay '%s' never assigned; add its coil somewhere.", "Relais internes '%s', jamais utilisés, à utiliser pour la commande de bobines dans le programme." },
+ { "Must assign pins for all I/O.\r\n\r\n'%s' is not assigned.", "Vous devez spécifier les broches pour toutes les E/S.\r\n\r\n'%s' ." },
+ { "UART in use; pins %d and %d reserved for that.", "UART utilisé; broches %d et %d réservée pour cette fonction." },
+ { "PWM in use; pin %d reserved for that.", "PWM utilisé; broche %d réservée pour cela." },
+ { "UART baud rate generator: divisor=%d actual=%.4f for %.2f%% error.\r\n\r\nThis is too large; try a different baud rate (slower probably), or a crystal frequency chosen to be divisible by many common baud rates (e.g. 3.6864 MHz, 14.7456 MHz).\r\n\r\nCode will be generated anyways but serial may be unreliable or completely broken.", "UART Générateur vitesse: Diviseur=%d actuel=%.4f pour %.2f%% Erreur.\r\n\r\nCeci est trop important; Essayez une autre vitesse (probablement plus lente), ou choisir un quartz divisible par plus de vitesses de transmission (comme 3.6864MHz, 14.7456MHz).\r\n\r\nCode est tout de même généré, mais la liaison peut être inutilisable ou la transmission erronée." },
+ { "UART baud rate generator: too slow, divisor overflows. Use a slower crystal or a faster baud rate.\r\n\r\nCode will be generated anyways but serial will likely be completely broken.", "Générateur vitesse UART trop lent, dépassement de capacité du diviseur. Utiliser un quartz plus lent ou une vitesse plus élevée.\r\n\r\nCode est généré mais la liaison semble inutilisable." },
+ { "Couldn't open '%s'\n", "Impossible d'ouvrir '%s'\n" },
+ { "Timer period too short (needs faster cycle time).", "Période temporisation trop courte (Diminuer le temps de cycle)." },
+ { "Timer period too long (max 32767 times cycle time); use a slower cycle time.", "Période de tempo trop longue (max. 32767 fois le temps de cycle); utiliser un temps de cycle plus long." },
+ { "Constant %d out of range: -32768 to 32767 inclusive.", "Constante %d hors limites: -32768 à 32767 inclus." },
+ { "Move instruction: '%s' not a valid destination.", "Instruction 'Mouvoir': '%s' n'est pas une destination valide." },
+ { "Math instruction: '%s' not a valid destination.", "Instruction Math: '%s' n'est pas une destination valide." },
+ { "Piecewise linear lookup table with zero elements!", "Le tableau indexé linéaire ne comporte aucun élément!" },
+ { "x values in piecewise linear table must be strictly increasing.", "Les valeurs x du tableau indexé linéaire doivent être obligatoirement dans un ordre croissant." },
+ { "Numerical problem with piecewise linear lookup table. Either make the table entries smaller, or space the points together more closely.\r\n\r\nSee the help file for details.", "Problème numérique avec le tableau. Commencer par les faibles valeurs ou rapprocher les points du tableau .\r\n\r\nVoir fichier d'aide pour plus de détails." },
+ { "Multiple escapes (\\0-9) present in format string, not allowed.", "Multiples ESC (\\0-9)présents dans un format chaines non permit." },
+ { "Bad escape: correct form is \\xAB.", "ESC incorrect: Forme correcte = \\xAB." },
+ { "Bad escape '\\%c'", "ESC incorrect '\\%c'" },
+ { "Variable is interpolated into formatted string, but none is specified.", "Une variable est appellée dans une chaine formattée, mais n'est pas spécifiée." },
+ { "No variable is interpolated into formatted string, but a variable name is specified. Include a string like '\\-3', or leave variable name blank.", "Aucune variable n'est appelée dans une chaine formattée, mais un nom de variable est spécifié . Insérer une chaine comme: '\\-3', ou laisser le nom de variable vide." },
+ { "Empty row; delete it or add instructions before compiling.", "Ligne vide; la supprimer ou ajouter instructions avant compilation." },
+ { "Couldn't write to '%s'", "Impossible d'écrire sous '%s'." },
+ { "Unsupported op (anything ADC, PWM, UART, EEPROM) for interpretable target.", "Instructions non supportées (comme ADC, PWM, UART, EEPROM ) pour sortie en code interprété." },
+ { "Compile successful; wrote interpretable code to '%s'.\r\n\r\nYou probably have to adapt the interpreter to your application. See the documentation.", "Compilé avec succès; Code interprété écrit sous '%s'.\r\n\r\nQue vous devez adapter probablement pour votre application. Voir documentation." },
+ { "Microcontroller '%s' not supported.\r\n\r\nDefaulting to no selected MCU.", "Microcontrolleur '%s' non supporté.\r\n\r\nErreur pas de MCU sélectionné." },
+ { "File format error; perhaps this program is for a newer version of LDmicro?", "Erreur format du fichier; ce programme est pour une nouvelle version de LDmicro." },
+ { "Index:", "Index:" },
+ { "Points:", "Points:" },
+ { "Count:", "Compteur:" },
+ { "Edit table of ASCII values like a string", "Editer tableau de valeur ASCII comme chaine" },
+ { "Look-Up Table", "Tableau indexé" },
+ { "Piecewise Linear Table", "Tableau d'éléments linéaire" },
+ { "LDmicro Error", "Erreur LDmicro" },
+ { "Compile Successful", "Compilé avec succès" },
+ { "digital in", "Entrée digitale" },
+ { "digital out", "Sortie digitale" },
+ { "int. relay", "Relais interne" },
+ { "UART tx", "UART tx" },
+ { "UART rx", "UART rx" },
+ { "PWM out", "Sortie PWM" },
+ { "turn-on delay", "Tempo travail" },
+ { "turn-off delay", "Tempo repos" },
+ { "retentive timer", "Tempo totalisatrice" },
+ { "counter", "Compteur" },
+ { "general var", "Var. générale" },
+ { "adc input", "Entrée ADC" },
+ { "<corrupt!>", "<Corrompu!>" },
+ { "(not assigned)", "(Non affecté)" },
+ { "<no UART!>", "<Pas UART!>" },
+ { "<no PWM!>", "<Pas de PWM!>" },
+ { "TOF: variable cannot be used elsewhere", "TOF: Variable ne peut être utilisée nullepart ailleurs" },
+ { "TON: variable cannot be used elsewhere", "TON: Variable ne peut être utilisée nullepart ailleurs" },
+ { "RTO: variable can only be used for RES elsewhere", "RTO: Variable ne peut être uniquement utilisée que pour RAZ" },
+ { "Variable '%s' not assigned to, e.g. with a MOV statement, an ADD statement, etc.\r\n\r\nThis is probably a programming error; now it will always be zero.", "Variable '%s' non affectée, ex: avec une commande MOV, une instruction ADD-etc.\r\n\r\nCeci est probablement une erreur de programmation; elle reste toujours à zéro." },
+ { "Variable for '%s' incorrectly assigned: %s.", "Variable pour '%s' Affectation incorrecte: %s." },
+ { "Division by zero; halting simulation", "Division par zéro; Simulation arrétée" },
+ { "!!!too long!!!", "!!!trop long!!" },
+ { "\n\nI/O ASSIGNMENT:\n\n", "\n\nE/S AFFECTATIONS:\n\n" },
+ { " Name | Type | Pin\n", " Nom | Type | Broche\n" },
+};
+static Lang LangFr = {
+ LangFrTable, sizeof(LangFrTable)/sizeof(LangFrTable[0])
+};
+#endif
+#ifdef LDLANG_IT
+static LangTable LangItTable[] = {
+ { "Target frequency %d Hz, closest achievable is %d Hz (warning, >5%% error).", "Target frequenza %d Hz, il più vicino realizzabile è %d Hz (avvertimento, >5%% di errore)." },
+ { "Compile successful; wrote IHEX for AVR to '%s'.\r\n\r\nRemember to set the processor configuration (fuses) correctly. This does not happen automatically.", "Compilazione ok; scritto IHEX per AVR a '%s'.\r\n\r\nRicorda di impostare il processore (Configurazione fusibili) correttamente. Questo non avviene automaticamente." },
+ { "( ) Normal", "( ) Aperto" },
+ { "(/) Negated", "(/) Negato" },
+ { "(S) Set-Only", "(S) Setta" },
+ { "(R) Reset-Only", "(R) Resetta" },
+ { "Pin on MCU", "Pin MCU" },
+ { "Coil", "Bobina" },
+ { "Comment", "Commento" },
+ { "Cycle Time (ms):", "Tempo di ciclo (ms):" },
+ { "Crystal Frequency (MHz):", "Frequenza quarzo (MHz):" },
+ { "UART Baud Rate (bps):", "UART Baud Rate (bps):" },
+ { "Serial (UART) will use pins %d and %d.\r\n\r\n", "Comunicazione seriale pin utilizzati %d et %d.\r\n\r\n" },
+ { "Please select a micro with a UART.\r\n\r\n", "Selezionare un processore dotato di UART.\r\n\r\n" },
+ { "No serial instructions (UART Send/UART Receive) are in use; add one to program before setting baud rate.\r\n\r\n", "Nessuna istruzione (UART trasmetti o UART ricevi) è utilizzata; aggiungere un istruzione prima di settare il baud rate.\r\n\r\n" },
+ { "The cycle time for the 'PLC' runtime generated by LDmicro is user-configurable. Very short cycle times may not be achievable due to processor speed constraints, and very long cycle times may not be achievable due to hardware overflows. Cycle times between 10 ms and 100 ms will usually be practical.\r\n\r\nThe compiler must know what speed crystal you are using with the micro to convert between timing in clock cycles and timing in seconds. A 4 MHz to 20 MHz crystal is typical; check the speed grade of the part you are using to determine the maximum allowable clock speed before choosing a crystal.", "Il tempo di ciclo per il 'PLC' LDmicro è configurabile dall' utente. Tempi di ciclo molto brevi possono non essere realizzabili a causa di vincoli di velocità del processore, e tempi di ciclo molto lunghi possono essere causa di overflow. Tempi di ciclo tra i 10 ms e di 100 ms di solito sono usuali.\r\n\r\nIl compilatore deve sapere che velocità di cristallo stai usando con il micro per convertire in cicli di clock i Tempi. Da 4 MHz a 20 MHz, è il cristallo tipico; determinare la velocità massima consentita prima di scegliere un cristallo." },
+ { "PLC Configuration", "Configurazione PLC" },
+ { "Zero cycle time not valid; resetting to 10 ms.", "Tempo di ciclo non valido; reimpostare a 10 ms." },
+ { "Source", "Sorgente" },
+ { "Internal Relay", "Relè interno" },
+ { "Input pin", "Input pin" },
+ { "Output pin", "Output pin" },
+ { "|/| Negated", "|/| Normalmente chiuso" },
+ { "Contacts", "Contatto" },
+ { "No ADC or ADC not supported for selected micro.", "Questo micro non suppota l'ADC." },
+ { "Assign:", "Assegna:" },
+ { "No microcontroller has been selected. You must select a microcontroller before you can assign I/O pins.\r\n\r\nSelect a microcontroller under the Settings menu and try again.", "Microcontrollore non selezionato. Selezionare un microcontrollore prima di assegnare i pin.\r\n\r\nSeleziona un microcontrollore dal il menu Impostazioni e riprova." },
+ { "I/O Pin Assignment", "Assegnazione Pin I/O" },
+ { "Can't specify I/O assignment for ANSI C target; compile and see comments in generated source code.", "Non specificare l'assegnazione dell' I/O per la generazione di ANSI C; compilare e visualizzare i commenti nel codice sorgente." },
+ { "Can't specify I/O assignment for interpretable target; see comments in reference implementation of interpreter.", "Non specificare l'assegnazione dell' I/O per la generazione di codice interpretabile; compilare e visualizzare i commenti nel codice sorgente." },
+ { "Can only assign pin number to input/output pins (Xname or Yname or Aname).", "Assegnare unicamente il numero di pin input/output (XNome, YNome ou ANome)." },
+ { "No ADC or ADC not supported for this micro.", "Questo micro non contiene ADC." },
+ { "Rename I/O from default name ('%s') before assigning MCU pin.", "Rinominare l' I/O per ottenere il nome di defolt ('%s') prima di assegnare i pin del Micro." },
+ { "I/O Pin", "I/O Pin" },
+ { "(no pin)", "(senza pin)" },
+ { "<UART needs!>", "<UART necessario!>" },
+ { "<PWM needs!>", "<PWM necessario!>" },
+ { "<not an I/O!>", "<nessun I/O!>" },
+ { "Export As Text", "Esportare il testo" },
+ { "Couldn't write to '%s'.", "Scrittura Impossibile '%s'." },
+ { "Compile To", "Per compilare" },
+ { "Must choose a target microcontroller before compiling.", "Scegliere un microcontrollore prima di compilare." },
+ { "UART function used but not supported for this micro.", "Le funzioni UART sono usate ma non supportate da questo micro." },
+ { "PWM function used but not supported for this micro.", "Le funzioni PWM sono usate ma non supportate da questo micro." },
+ { "The program has changed since it was last saved.\r\n\r\nDo you want to save the changes?", "Il programma è cambiato da quando è stato salvato l'ultima volta.\r\n\r\nDo si desidera salvare le modifiche? " },
+ { "--add comment here--", "--aggiungere il commento--" },
+ { "Start new program?", "Iniziare nuovo programma?" },
+ { "Couldn't open '%s'.", "Impossibile aprire '%s'." },
+ { "Name", "Nome" },
+ { "State", "Stato" },
+ { "Pin on Processor", "Pin del Micro" },
+ { "MCU Port", "Porta del processore" },
+ { "LDmicro - Simulation (Running)", "LDmicro - Simulazione (in corso)" },
+ { "LDmicro - Simulation (Stopped)", "LDmicro - Simulazione (Ferma)" },
+ { "LDmicro - Program Editor", "LDmicro - Scrivere il programma" },
+ { " - (not yet saved)", " - (non ancora salvato)" },
+ { "&New\tCtrl+N", "&Nuovo\tCtrl+N" },
+ { "&Open...\tCtrl+O", "&Aprire...\tCtrl+O" },
+ { "&Save\tCtrl+S", "&Salva\tCtrl+S" },
+ { "Save &As...", "Salva &con nome..." },
+ { "&Export As Text...\tCtrl+E", "&Esportare il testo...\tCtrl+E" },
+ { "E&xit", "U&scita" },
+ { "&Undo\tCtrl+Z", "&Torna indietro\tCtrl+Z" },
+ { "&Redo\tCtrl+Y", "&Rifare\tCtrl+Y" },
+ { "Insert Rung &Before\tShift+6", "Inserire Ramo &Davanti\tShift+6" },
+ { "Insert Rung &After\tShift+V", "Inserire Ramo &Dietro\tShift+V" },
+ { "Move Selected Rung &Up\tShift+Up", "Muove il Ramo selezionato &Su\tShift+Up" },
+ { "Move Selected Rung &Down\tShift+Down", "Muove il Ramo selezionato &Giù\tShift+Down" },
+ { "&Delete Selected Element\tDel", "&Cancella l'elemento selezionato\tDel" },
+ { "D&elete Rung\tShift+Del", "Cancellare il Ramo\tShift+Del" },
+ { "Insert Co&mment\t;", "Inserire Co&mmento\t;" },
+ { "Insert &Contacts\tC", "Inserire &Contatto\tC" },
+ { "Insert OSR (One Shot Rising)\t&/", "Inserire PULSUP (Fronte di salita)\t&/" },
+ { "Insert OSF (One Shot Falling)\t&\\", "Inserire PULSDW (Fronte di discesa)\t&\\" },
+ { "Insert T&ON (Delayed Turn On)\tO", "Inserire T&ON (Tempo di ritardo On)\tO" },
+ { "Insert TO&F (Delayed Turn Off)\tF", "Inserire TO&F (Tempo di ritardo Off)\tF" },
+ { "Insert R&TO (Retentive Delayed Turn On)\tT", "Inserire R&TO (Tempo di ritardo ritentivo On)\tT" },
+ { "Insert CT&U (Count Up)\tU", "Inserire CT&U (Contatore Up)\tU" },
+ { "Insert CT&D (Count Down)\tI", "Inserire CT&D (Contatore Down)\tI" },
+ { "Insert CT&C (Count Circular)\tJ", "Inserire CT&C (Contatore ciclico)\tJ" },
+ { "Insert EQU (Compare for Equals)\t=", "Inserire EQU (Compara per Uguale)\t=" },
+ { "Insert NEQ (Compare for Not Equals)", "Inserire NEQ (Compara per Diverso)" },
+ { "Insert GRT (Compare for Greater Than)\t>", "Inserire GRT (Compara per Maggiore)\t>" },
+ { "Insert GEQ (Compare for Greater Than or Equal)\t.", "Inserire GEQ (Compara per Maggiore o Uguale)\t." },
+ { "Insert LES (Compare for Less Than)\t<", "Inserire LES (Compara per Minore)\t<" },
+ { "Insert LEQ (Compare for Less Than or Equal)\t,", "Inserire LEQ (Compara per Minore o Uguale)\t," },
+ { "Insert Open-Circuit", "Inserire Circuito Aperto" },
+ { "Insert Short-Circuit", "Inserire Corto Circuito" },
+ { "Insert Master Control Relay", "Inserire Master Control Relay" },
+ { "Insert Coi&l\tL", "Inserire Bobina Re&lè\tL" },
+ { "Insert R&ES (Counter/RTO Reset)\tE", "Inserire R&ES (Contatore/RTO Reset)\tE" },
+ { "Insert MOV (Move)\tM", "Inserire MOV (Spostare)\tM" },
+ { "Insert ADD (16-bit Integer Add)\t+", "Inserire ADD (Addizione intera 16-bit)\t+" },
+ { "Insert SUB (16-bit Integer Subtract)\t-", "Inserire SUB (Sottrazione intera 16-bit)\t-" },
+ { "Insert MUL (16-bit Integer Multiply)\t*", "Inserire MUL (Moltiplicazione intera 16-bit)\t*" },
+ { "Insert DIV (16-bit Integer Divide)\tD", "Inserire DIV (Divisione intera 16-bit)\tD" },
+ { "Insert Shift Register", "Inserire Shift Register" },
+ { "Insert Look-Up Table", "Inserire Tavola Indicizzata" },
+ { "Insert Piecewise Linear", "Inserire Tavola di Elementi Lineari" },
+ { "Insert Formatted String Over UART", "Inserire Stringhe Formattate per l'UART" },
+ { "Insert &UART Send", "Inserire Trasmissione &UART" },
+ { "Insert &UART Receive", "Inserire Ricezione &UART" },
+ { "Insert Set PWM Output", "Inserire Valore di Uscita PWM" },
+ { "Insert A/D Converter Read\tP", "Inserire Lettura del Convertitore A/D\tP" },
+ { "Insert Make Persistent", "Inserire Scrittura Permanente" },
+ { "Make Norm&al\tA", "Attivazione Norm&ale\tA" },
+ { "Make &Negated\tN", "Attivazione &Negata\tN" },
+ { "Make &Set-Only\tS", "Attivazione &Solo-Set\tS" },
+ { "Make &Reset-Only\tR", "Attivazione &Solo-Reset\tR" },
+ { "&MCU Parameters...", "&Parametri MCU..." },
+ { "(no microcontroller)", "(nessun microcontroller)" },
+ { "&Microcontroller", "&Microcontroller" },
+ { "Si&mulation Mode\tCtrl+M", "Modo Si&mulazione\tCtrl+M" },
+ { "Start &Real-Time Simulation\tCtrl+R", "Avviare la &Simulazione in Tempo Reale\tCtrl+R" },
+ { "&Halt Simulation\tCtrl+H", "&Arrestare la Simulazione\tCtrl+H" },
+ { "Single &Cycle\tSpace", "Singolo &Ciclo\tSpazio" },
+ { "&Compile\tF5", "&Compila\tF5" },
+ { "Compile &As...", "Compila &Come..." },
+ { "&Manual...\tF1", "&Manuale...\tF1" },
+ { "&About...", "&About..." },
+ { "&File", "&File" },
+ { "&Edit", "&Editazione" },
+ { "&Settings", "&Settaggi" },
+ { "&Instruction", "&Istruzione" },
+ { "Si&mulate", "Si&mulazione" },
+ { "&Compile", "&Compilazione" },
+ { "&Help", "&Aiuto" },
+ { "no MCU selected", "nessuna MCU selezionata" },
+ { "cycle time %.2f ms", "tempo ciclo %.2f ms" },
+ { "processor clock %.4f MHz", "clock processore %.4f MHz" },
+ { "Internal error relating to PIC paging; make program smaller or reshuffle it.", "Errore interno relativo allla paginazione PIC; rendere il programma più piccolo." },
+ { "PWM frequency too fast.", "Frequenza PWM troppo alta." },
+ { "PWM frequency too slow.", "Frequenza PWM tropppo lenta." },
+ { "Cycle time too fast; increase cycle time, or use faster crystal.", "Tempo di ciclo troppo veloce; aumentare il tempo di ciclo o utilizzare un quarzo più veloce." },
+ { "Cycle time too slow; decrease cycle time, or use slower crystal.", "Tempo di ciclo troppo lento; diminuire il tempo di ciclo o utilizzare un quarzo più lento." },
+ { "Couldn't open file '%s'", "Impossibile aprire il file '%s'" },
+ { "Zero baud rate not possible.", "baud rate = Zero non è possibile" },
+ { "Compile successful; wrote IHEX for PIC16 to '%s'.\r\n\r\nConfiguration word (fuses) has been set for crystal oscillator, BOD enabled, LVP disabled, PWRT enabled, all code protection off.\r\n\r\nUsed %d/%d words of program flash (chip %d%% full).", "Compilato con successo; scritto IHEX per PIC16 per '%s'.\r\n\r\nConfigurazione word (fusibili), è stato fissato per il cristallo oscillatore, BOD abilitato, LVP disabilitati, PWRT attivato, tutto il codice di protezione off.\r\n\r\nUsed %d/%d word di Programma flash (chip %d%% full)." },
+ { "Type", "Tipo" },
+ { "Timer", "Temporizzazione" },
+ { "Counter", "Contatore" },
+ { "Reset", "Reset" },
+ { "OK", "OK" },
+ { "Cancel", "Cancellare" },
+ { "Empty textbox; not permitted.", "Spazio vuoto per testo; non è consentito" },
+ { "Bad use of quotes: <%s>", "Quota utilizzata scorretta: <%s>" },
+ { "Turn-On Delay", "Ritardo all' eccitazione" },
+ { "Turn-Off Delay", "Ritardo alla diseccitazione" },
+ { "Retentive Turn-On Delay", "Ritardo Ritentivo all' eccitazione" },
+ { "Delay (ms):", "Ritardo (ms):" },
+ { "Delay too long; maximum is 2**31 us.", "Ritardo troppo lungo; massimo 2**31 us." },
+ { "Delay cannot be zero or negative.", "Ritardo zero o negativo non possibile." },
+ { "Count Up", "Contatore in avanti" },
+ { "Count Down", "Contatore in discesa" },
+ { "Circular Counter", "Contatore ciclico" },
+ { "Max value:", "Valore massimo:" },
+ { "True if >= :", "Vero se >= :" },
+ { "If Equals", "Se Uguale" },
+ { "If Not Equals", "Se non Uguale" },
+ { "If Greater Than", "Se più grande di" },
+ { "If Greater Than or Equal To", "Se più grande o uguale di" },
+ { "If Less Than", "Se più piccolo di" },
+ { "If Less Than or Equal To", "Se più piccolo o uguale di" },
+ { "'Closed' if:", "Chiuso se:" },
+ { "Move", "Spostare" },
+ { "Read A/D Converter", "Lettura del convertitore A/D" },
+ { "Duty cycle var:", "Duty cycle var:" },
+ { "Frequency (Hz):", "Frequenza (Hz):" },
+ { "Set PWM Duty Cycle", "Settare PWM Duty Cycle" },
+ { "Source:", "Sorgente:" },
+ { "Receive from UART", "Ricezione dall' UART" },
+ { "Send to UART", "Trasmissione all' UART" },
+ { "Add", "Addizione" },
+ { "Subtract", "Sottrazione" },
+ { "Multiply", "Moltiplicazione" },
+ { "Divide", "Divisione" },
+ { "Destination:", "Destinazione:" },
+ { "is set := :", "é impostato := :" },
+ { "Name:", "Nome:" },
+ { "Stages:", "Stati:" },
+ { "Shift Register", "Registro a scorrimento" },
+ { "Not a reasonable size for a shift register.", "Non è una dimensione ragionevole per un registro scorrimento." },
+ { "String:", "Stringhe:" },
+ { "Formatted String Over UART", "Stringhe formattate per l'UART" },
+ { "Variable:", "Variabile:" },
+ { "Make Persistent", "Memoria rimanante" },
+ { "Too many elements in subcircuit!", "Troppi elementi nel circuito secondario!" },
+ { "Too many rungs!", "Troppi rami!" },
+ { "Error", "Errore" },
+ { "ANSI C target does not support peripherals (UART, PWM, ADC, EEPROM). Skipping that instruction.", "Il codice in uscita ANSI C non supporta queste istruzioni (UART, PWM, ADC, EEPROM). Non usare queste istruzioni." },
+ { "Compile successful; wrote C source code to '%s'.\r\n\r\nThis is not a complete C program. You have to provide the runtime and all the I/O routines. See the comments in the source code for information about how to do this.", "Compilato con successo; scritto il codice sorgente in C '%s'.\r\n\r\nIl non è un completo programma in C. Si deve fornire il runtime e tutti gli I / O di routine. Vedere i commenti nel codice sorgente per informazioni su come fare." },
+ { "Cannot delete rung; program must have at least one rung.", "Non è in grado di eliminare le linee; il programma deve avere almeno una linea." },
+ { "Out of memory; simplify program or choose microcontroller with more memory.", "Memoria insufficiente; semplificare il programma oppure scegliere microcontrollori con più memoria ." },
+ { "Must assign pins for all ADC inputs (name '%s').", "Devi assegnare i pin per tutti gli ingressi ADC (nom '%s')." },
+ { "Internal limit exceeded (number of vars)", "Superato il limite interno (numero di variabili)" },
+ { "Internal relay '%s' never assigned; add its coil somewhere.", "Relè interno '%s' non assegnato; aggiungere la sua bobina." },
+ { "Must assign pins for all I/O.\r\n\r\n'%s' is not assigned.", "Devi assegnare tutti i pin di I / O.\r\n\r\n'%s' non è stato assegnato." },
+ { "UART in use; pins %d and %d reserved for that.", "UART in uso; pins %d et %d riservati per questa." },
+ { "PWM in use; pin %d reserved for that.", "PWM utilizzato; pin %d riservati per questo." },
+ { "UART baud rate generator: divisor=%d actual=%.4f for %.2f%% error.\r\n\r\nThis is too large; try a different baud rate (slower probably), or a crystal frequency chosen to be divisible by many common baud rates (e.g. 3.6864 MHz, 14.7456 MHz).\r\n\r\nCode will be generated anyways but serial may be unreliable or completely broken.", "UART generatore di baud rate: divisore = %d effettivo = %.4f per %.2f%% di errore.\r\n\r\nIl è troppo grande; prova un altro baud rate (probabilmente più lento), o il quarzo scelto non è divisibile per molti comuni baud (ad esempio, 3.6864 MHz, 14.7456 MHz).\r\n\r\nIl codice verrà generato, ma comunque può essere inaffidabile o completamente non funzionante." },
+ { "UART baud rate generator: too slow, divisor overflows. Use a slower crystal or a faster baud rate.\r\n\r\nCode will be generated anyways but serial will likely be completely broken.", "UART generatore di baud rate: troppo lento, overflow. Utilizzare un quarzo più lento o una velocità più alta di baud.\r\n\r\nIl codice verrà generato, ma comunque sarà probabilmente completamente inutilizzabile." },
+ { "Couldn't open '%s'\n", "Impossibile aprire '%s'\n" },
+ { "Timer period too short (needs faster cycle time).", "Periodo troppo corto (Diminuire il tempo de ciclo)." },
+ { "Timer period too long (max 32767 times cycle time); use a slower cycle time.", "Tempo troppo lungo (max 32767 volte di ciclo); utilizzare un tempo di ciclo più lento." },
+ { "Constant %d out of range: -32768 to 32767 inclusive.", "Costante %d oltre il limite: -32768 a 32767 inclusi." },
+ { "Move instruction: '%s' not a valid destination.", "Sposta istruzione: '%s' non è una destinazione valida." },
+ { "Math instruction: '%s' not a valid destination.", "Math istruzione: '%s' non è una destinazione valida" },
+ { "Piecewise linear lookup table with zero elements!", "La tabella lineare di ricerca non contiene elementi!" },
+ { "x values in piecewise linear table must be strictly increasing.", "X valori nella tabella lineare devono essere crescenti." },
+ { "Numerical problem with piecewise linear lookup table. Either make the table entries smaller, or space the points together more closely.\r\n\r\nSee the help file for details.", "Problema numerico con la tabella lineare di ricerca. Sia la tabella voci più piccole, o insieme di punti più vicini.\r\n\r\nVedere il file di aiuto per ulteriori dettagli." },
+ { "Multiple escapes (\\0-9) present in format string, not allowed.", "Uscita multipla (\\0-9) presente nel formato stringa, non consentito." },
+ { "Bad escape: correct form is \\xAB.", "Uscita errata: Forma non corretta = \\xAB." },
+ { "Bad escape '\\%c'", "Uscita non corretta '\\%c'" },
+ { "Variable is interpolated into formatted string, but none is specified.", "Variabile interpolata in formato stringa, ma non è specificata." },
+ { "No variable is interpolated into formatted string, but a variable name is specified. Include a string like '\\-3', or leave variable name blank.", "Variabile interpolata non in formato stringa, ma un nome di variabile è stato specificato. Includi una stringa come '\\-3', o lasciare vuoto." },
+ { "Empty row; delete it or add instructions before compiling.", "Riga vuota, eliminare o aggiungere istruzioni prima di compilare." },
+ { "Couldn't write to '%s'", "Impossibile scrivere qui '%s'." },
+ { "Unsupported op (anything ADC, PWM, UART, EEPROM) for interpretable target.", "Istruzioni non supportate (come ADC, PWM, UART, EEPROM ) per il codice interpretato." },
+ { "Compile successful; wrote interpretable code to '%s'.\r\n\r\nYou probably have to adapt the interpreter to your application. See the documentation.", "Compilazione riuscita; codice interpretabile scritto per '%s'.\r\n\r\nSi dovrà probabilmente adattare l'interprete per la vostra applicazione. Vedi la documentazione." },
+ { "Microcontroller '%s' not supported.\r\n\r\nDefaulting to no selected MCU.", "Microcontrollore '%s' non è supportato.\r\n\r\nNessuna MCU selezionata di default." },
+ { "File format error; perhaps this program is for a newer version of LDmicro?", "Errore del formato del file, forse questo è il programma per una nuova versione di LDmicro?" },
+ { "Index:", "Indice:" },
+ { "Points:", "Punto:" },
+ { "Count:", "Contatore:" },
+ { "Edit table of ASCII values like a string", "Modifica tabella dei valori ASCII come stringa" },
+ { "Look-Up Table", "Tabella indicizzata" },
+ { "Piecewise Linear Table", "Tabella di elementi lineari" },
+ { "LDmicro Error", "Errore LDmicro" },
+ { "Compile Successful", "Compilato con successo" },
+ { "digital in", "Input digitale" },
+ { "digital out", "Uscita digitale" },
+ { "int. relay", "Relè interno" },
+ { "UART tx", "UART tx" },
+ { "UART rx", "UART rx" },
+ { "PWM out", "Uscita PWM" },
+ { "turn-on delay", "ritardo all' eccitazione" },
+ { "turn-off delay", "ritardo alla diseccitazione" },
+ { "retentive timer", "ritardo ritentivo" },
+ { "counter", "contatore" },
+ { "general var", "Var. generale" },
+ { "adc input", "Ingrasso ADC" },
+ { "<corrupt!>", "<Corrotto!>" },
+ { "(not assigned)", "(non assegnato)" },
+ { "<no UART!>", "<nessuna UART!>" },
+ { "<no PWM!>", "<nessun PWM!>" },
+ { "TOF: variable cannot be used elsewhere", "TOF: la variabile non può essere utilizzata altrove" },
+ { "TON: variable cannot be used elsewhere", "TON: la variabile non può essere utilizzata altrove" },
+ { "RTO: variable can only be used for RES elsewhere", "RTO: la variabile può essere utilizzata altrove solo per il RES" },
+ { "Variable '%s' not assigned to, e.g. with a MOV statement, an ADD statement, etc.\r\n\r\nThis is probably a programming error; now it will always be zero.", "Variabile '%s' non assegnate, ad esempio, con una dichiarazione, MOV, una dichiarazione ADD, ecc\r\n\r\nQuesto è probabilmente un errore di programmazione; ora sarà sempre uguale a zero." },
+ { "Variable for '%s' incorrectly assigned: %s.", "Variabile per '%s' assegnazione incorretta: %s." },
+ { "Division by zero; halting simulation", "Divisione per zero; Simulazione fermata" },
+ { "!!!too long!!!", "!troppo lungo!" },
+ { "\n\nI/O ASSIGNMENT:\n\n", "\n\nE/S ASSEGNAZIONE:\n\n" },
+ { " Name | Type | Pin\n", " Nome | Type | Pin\n" },
+};
+static Lang LangIt = {
+ LangItTable, sizeof(LangItTable)/sizeof(LangItTable[0])
+};
+#endif
+#ifdef LDLANG_PT
+static LangTable LangPtTable[] = {
+ { "Target frequency %d Hz, closest achievable is %d Hz (warning, >5%% error).", "Freqüência do Micro %d Hz, a melhor aproximação é %d Hz (aviso, >5%% error)." },
+ { "Compile successful; wrote IHEX for AVR to '%s'.\r\n\r\nRemember to set the processor configuration (fuses) correctly. This does not happen automatically.", "Compilação sucedida; se escrito em IHEX para AVR para '%s'.\r\n\r\nLembrar de anotar as configurações (fuses) do micro, corretamente. Isto não acontece automaticamente." },
+ { "( ) Normal", "( ) Normal" },
+ { "(/) Negated", "(/) Negado" },
+ { "(S) Set-Only", "(S) Ativar" },
+ { "(R) Reset-Only", "(R) Desativar" },
+ { "Pin on MCU", "Pino no Micro" },
+ { "Coil", "Bobina" },
+ { "Comment", "Comentário" },
+ { "Cycle Time (ms):", "Tempo de Ciclo (ms):" },
+ { "Crystal Frequency (MHz):", "Freqüência Cristal (MHz):" },
+ { "UART Baud Rate (bps):", "Baud Rate UART (bps):" },
+ { "Serie (UART) will use pins %d and %d.\r\n\r\n", "Porta Serial (UART) usará os pinos %d e %d.\r\n\r\n" },
+ { "Please select a micro with a UART.\r\n\r\n", "Por favor, selecione um micro com UART.\r\n\r\n" },
+ { "No serial instructions (UART Send/UART Receive) are in use; add one to program before setting baud rate.\r\n\r\n", "Nenhuma instrução serial (UART Enviar/UART Recebe) está em uso; adicione uma ao programa antes de configurar a taxa de transmissão (baud rate).\r\n\r\n" },
+ { "The cycle time for the 'PLC' runtime generated by LDmicro is user-configurable. Very short cycle times may not be achievable due to processor speed constraints, and very long cycle times may not be achievable due to hardware overflows. Cycle times between 10 ms and 100 ms will usually be practical.\r\n\r\nThe compiler must know what speed crystal you are using with the micro to convert between timing in clock cycles and timing in seconds. A 4 MHz to 20 MHz crystal is typical; check the speed grade of the part you are using to determine the maximum allowable clock speed before choosing a crystal.", "O tempo de ciclo para o PLC generalizado pelo LDmicro é configuravel pelo usuário. Tempos de ciclo muito pequenos podem não ser realizáveis devido a baixa velocidade do processador, e tempos de ciclo muito longos podem não ser realizáveis devido ao temporizador do micro. Ciclos de tempo entre 10 e 100ms são mais usuais.\r\n\r\n O compilador tem que saber qual é a freqüência do cristal que está sendo usado para poder converter entre o tempo em ciclos do clock e tempo em segundos. Cristais entre 4 Mhz e 20 Mhz são os mais típicos. Confira a velocidade que pode funcionar seu micro e calcule a velocidade máxima do clock antes de encolher o cristal." },
+ { "PLC Configuration", "Configuração PLC" },
+ { "Zero cycle time not valid; resetting to 10 ms.", "Não é válido um tempo de ciclo 0; retornando a 10 ms." },
+ { "Source", "Fonte" },
+ { "Internal Relay", "Rele Interno" },
+ { "Input pin", "Pino Entrada" },
+ { "Output pin", "Pino Saida" },
+ { "|/| Negated", "|/| Negado" },
+ { "Contacts", "Contatos" },
+ { "No ADC or ADC not supported for selected micro.", "O micro selecionado não possui ADC ou não suporta." },
+ { "Assign:", "Atribua:" },
+ { "No microcontroller has been selected. You must select a microcontroller before you can assign I/O pins.\r\n\r\nSelect a microcontroller under the Settings menu and try again.", "Nenhum micro esta selecionado. Você deve selecionar um micro antes de atribuir os pinos E/S.\r\n\r\nSelecione um micro no menu de configuração e tente novamente." },
+ { "I/O Pin Assignment", "Atribuição de Pinos de E/S" },
+ { "Can't specify I/O assignment for ANSI C target; compile and see comments in generated source code.", "Não se pode atribuir as E/S especificadas para o ANSI C gerado; compile e veja os comentários gerados no código fonte." },
+ { "Can't specify I/O assignment for interpretable target; see comments in reference implementation of interpreter.", "Não se pode atribuir as E/S especificadas para o código gerado para o interpretador; veja os comentários na implementação do interpretador." },
+ { "Can only assign pin number to input/output pins (Xname or Yname or Aname).", "Somente pode atribuir números dos pinos aos pinos de Entrada/Saída (Xname ou Yname ou Aname)." },
+ { "No ADC or ADC not supported for this micro.", "Este micro não tem ADC ou não é suportado." },
+ { "Rename I/O from default name ('%s') before assigning MCU pin.", "Renomear as E/S para nome padrão ('%s') antes de atribuir um pino do micro." },
+ { "I/O Pin", "Pino E/S" },
+ { "(no pin)", "(sem pino)" },
+ { "<UART needs!>", "<Se necessitar UART!>" },
+ { "<PWM needs!>", "<Se necessitar PWM!>" },
+ { "<not an I/O!>", "<Não é uma E/S!>" },
+ { "Export As Text", "Exportar como Texto" },
+ { "Couldn't write to '%s'.", "Não pode gravar para '%s'." },
+ { "Compile To", "Compilar Para" },
+ { "Must choose a target microcontroller before compiling.", "Deve selecionar um microcontrolador antes de compilar." },
+ { "UART function used but not supported for this micro.", "Função UART é usada porem não suportada por este micro." },
+ { "PWM function used but not supported for this micro.", "Função PWM é usada porem não suportada por este micro." },
+ { "The program has changed since it was last saved.\r\n\r\nDo you want to save the changes?", "Este programa contem mudanças desde a ultima vez salva.\r\n\r\n Você quer salvar as mudanças?" },
+ { "--add comment here--", "--Adicione Comentários Aqui--" },
+ { "Start new program?", "Iniciar um novo programa?" },
+ { "Couldn't open '%s'.", "Não pode abrir '%s'." },
+ { "Name", "Nome" },
+ { "State", "Estado" },
+ { "Pin on Processor", "Pino do Processador" },
+ { "MCU Port", "Porta do Micro" },
+ { "LDmicro - Simulation (Running)", "LDmicro - Simulação (Executando)" },
+ { "LDmicro - Simulation (Stopped)", "LDmicro - Simulação (Parado)" },
+ { "LDmicro - Program Editor", "LDmicro - Editor de Programa" },
+ { " - (not yet saved)", " - (ainda não salvo)" },
+ { "&New\tCtrl+N", "&Novo\tCtrl+N" },
+ { "&Open...\tCtrl+O", "&Abrir...\tCtrl+O" },
+ { "&Save\tCtrl+S", "&Salvar\tCtrl+S" },
+ { "Save &As...", "Salvar &Como..." },
+ { "&Export As Text...\tCtrl+E", "&Exportar como Texto...\tCtrl+E" },
+ { "E&xit", "&Sair" },
+ { "&Undo\tCtrl+Z", "&Desfazer\tCtrl+Z" },
+ { "&Redo\tCtrl+Y", "&Refazer\tCtrl+Y" },
+ { "Insert Rung &Before\tShift+6", "Inserir Linha (Rung) &Antes\tShift+6" },
+ { "Insert Rung &After\tShift+V", "Inserir Linha (Rung) &Depois\tShift+V" },
+ { "Move Selected Rung &Up\tShift+Up", "Mover Linha Selecionada (Rung) &Acima\tShift+Up" },
+ { "Move Selected Rung &Down\tShift+Down", "Mover Linha Selecionada(Rung) &Abaixo\tShift+Down" },
+ { "&Delete Selected Element\tDel", "&Apagar Elemento Selecionado\tDel" },
+ { "D&elete Rung\tShift+Del", "A&pagar Linha (Rung) \tShift+Del" },
+ { "Insert Co&mment\t;", "Inserir Co&mentário\t;" },
+ { "Insert &Contacts\tC", "Inserir &Contatos\tC" },
+ { "Insert OSR (One Shot Rising)\t&/", "Inserir OSR (Detecta Borda de Subida)\t&/" },
+ { "Insert OSF (One Shot Falling)\t&\\", "Inserir OSF (Detecta Borda de Descida)\t&\\" },
+ { "Insert T&ON (Delayed Turn On)\tO", "Inserir T&ON (Temporizador para Ligar)\tO" },
+ { "Insert TO&F (Delayed Turn Off)\tF", "Inserir TO&F (Temporizador para Desligar)\tF" },
+ { "Insert R&TO (Retentive Delayed Turn On)\tT", "Inserir R&TO (Temporizar Retentivo para Ligar)\tT" },
+ { "Insert CT&U (Count Up)\tU", "Inserir CT&U (Contador Incremental)\tU" },
+ { "Insert CT&D (Count Down)\tI", "Inserir CT&D (Contador Decremental)\tI" },
+ { "Insert CT&C (Count Circular)\tJ", "Inserir CT&C (Contador Circular)\tJ" },
+ { "Insert EQU (Compare for Equals)\t=", "Inserir EQU (Comparar se é Igual)\t=" },
+ { "Insert NEQ (Compare for Not Equals)", "Inserir NEQ (Comparar se é Diferente)" },
+ { "Insert GRT (Compare for Greater Than)\t>", "Inserir GRT (Comparar se Maior Que)\t>" },
+ { "Insert GEQ (Compare for Greater Than or Equal)\t.", "Inserir GEQ (Comparar se Maior ou Igual Que)\t." },
+ { "Insert LES (Compare for Less Than)\t<", "Inserir LES (Comparar se Menor Que)\t<" },
+ { "Insert LEQ (Compare for Less Than or Equal)\t,", "Inserir LEQ (Comparar se Menor ou Igual Que)\t," },
+ { "Insert Open-Circuit", "Inserir Circuito Aberto" },
+ { "Insert Short-Circuit", "Inserir Curto Circuito" },
+ { "Insert Master Control Relay", "Inserir Rele de Controle Mestre" },
+ { "Insert Coi&l\tL", "Inserir &Bobina\tL" },
+ { "Insert R&ES (Counter/RTO Reset)\tE", "Inserir R&ES (Contador/RTO Reinicia)\tE" },
+ { "Insert MOV (Move)\tM", "Inserir MOV (Mover)\tM" },
+ { "Insert ADD (16-bit Integer Add)\t+", "Inserir ADD (Soma Inteiro 16-bit)\t+" },
+ { "Insert SUB (16-bit Integer Subtract)\t-", "Inserir SUB (Subtrair Inteiro 16-bit)\t-" },
+ { "Insert MUL (16-bit Integer Multiply)\t*", "Inserir MUL (Multiplica Inteiro 16-bit)\t*" },
+ { "Insert DIV (16-bit Integer Divide)\tD", "Inserir DIV (Divide Inteiro 16-bit)\tD" },
+ { "Insert Shift Register", "Inserir Registro de Troca" },
+ { "Insert Look-Up Table", "Inserir Tabela de Busca" },
+ { "Insert Piecewise Linear", "Inserir Linearização por Segmentos" },
+ { "Insert Formatted String Over UART", "Inserir String Formatada na UART" },
+ { "Insert &UART Send", "Inserir &UART Enviar" },
+ { "Insert &UART Receive", "Inserir &UART Receber" },
+ { "Insert Set PWM Output", "Inserir Valor de Saída PWM" },
+ { "Insert A/D Converter Read\tP", "Inserir Leitura do Conversor A/D\tP" },
+ { "Insert Make Persistent", "Inserir Fazer Permanente" },
+ { "Make Norm&al\tA", "Fazer Norm&al\tA" },
+ { "Make &Negated\tN", "Fazer &Negado\tN" },
+ { "Make &Set-Only\tS", "Fazer &Ativar-Somente\tS" },
+ { "Make &Reset-Only\tR", "Fazer&Desativar-Somente\tR" },
+ { "&MCU Parameters...", "&Parâmetros do Micro..." },
+ { "(no microcontroller)", "(sem microcontrolador)" },
+ { "&Microcontroller", "&Microcontrolador" },
+ { "Si&mulation Mode\tCtrl+M", "Modo Si&mulação \tCtrl+M" },
+ { "Start &Real-Time Simulation\tCtrl+R", "Iniciar Simulação em Tempo &Real\tCtrl+R" },
+ { "&Halt Simulation\tCtrl+H", "Parar Simulação\tCtrl+H" },
+ { "Single &Cycle\tSpace", "Simples &Ciclo\tEspaço" },
+ { "&Compile\tF5", "&Compilar\tF5" },
+ { "Compile &As...", "Compilar &Como..." },
+ { "&Manual...\tF1", "&Manual...\tF1" },
+ { "&About...", "&Sobre..." },
+ { "&File", "&Arquivo" },
+ { "&Edit", "&Editar" },
+ { "&Settings", "&Configurações" },
+ { "&Instruction", "&Instruções" },
+ { "Si&mulate", "Si&mular" },
+ { "&Compile", "&Compilar" },
+ { "&Help", "&Ajuda" },
+ { "no MCU selected", "Micro não selecionado" },
+ { "cycle time %.2f ms", "tempo de ciclo %.2f ms" },
+ { "processor clock %.4f MHz", "clock do processador %.4f MHz" },
+ { "Internal error relating to PIC paging; make program smaller or reshuffle it.", "Erro interno relativo a paginação do PIC; fazer um programa menor ou reorganiza-lo" },
+ { "PWM frequency too fast.", "Freqüência do PWM muito alta." },
+ { "PWM frequency too slow.", "Freqüência do PWM muito baixa." },
+ { "Cycle time too fast; increase cycle time, or use faster crystal.", "Tempo de Ciclo muito rápido; aumentar tempo do ciclo, ou usar um cristal de maior Mhz." },
+ { "Cycle time too slow; decrease cycle time, or use slower crystal.", "Tempo de Ciclo muito lento; diminuir tempo do ciclo, ou usar um cristal de menor Mhz." },
+ { "Couldn't open file '%s'", "Não pode abrir o arquivo '%s'" },
+ { "Zero baud rate not possible.", "Zero Baud Rate não é possível." },
+ { "Compile successful; wrote IHEX for PIC16 to '%s'.\r\n\r\nConfiguration word (fuses) has been set for crystal oscillator, BOD enabled, LVP disabled, PWRT enabled, all code protection off.\r\n\r\nUsed %d/%d words of program flash (chip %d%% full).", "Compilação sucedida; escrito IHEX para PIC16 em '%s'.\r\n\r\nBits de Configuração (fuses) foi estabelecido para o cristal oscilador, BOD ativado, LVP desativado, PWRT ativado, Todos os bits de proteção desativados.\r\n\r\nUsadas %d/%d palavras de programa em flash (Chip %d%% completo)." },
+ { "Type", "Tipo" },
+ { "Timer", "Temporizador" },
+ { "Counter", "Contador" },
+ { "Reset", "Reiniciar" },
+ { "OK", "OK" },
+ { "Cancel", "Cancelar" },
+ { "Empty textbox; not permitted.", "Texto vazio; não é permitido" },
+ { "Bad use of quotes: <%s>", "Mau uso das aspas: <%s>" },
+ { "Turn-On Delay", "Temporizador para Ligar" },
+ { "Turn-Off Delay", "Temporizador para Desligar" },
+ { "Retentive Turn-On Delay", "Temporizador Retentivo para Ligar" },
+ { "Delay (ms):", "Tempo (ms):" },
+ { "Delay too long; maximum is 2**31 us.", "Tempo muito longo; Maximo 2**31 us." },
+ { "Delay cannot be zero or negative.", "Tempo não pode ser zero ou negativo." },
+ { "Count Up", "Contador Crescente" },
+ { "Count Down", "Contador Decrescente" },
+ { "Circular Counter", "Contador Circular" },
+ { "Max value:", "Valor Max:" },
+ { "True if >= :", "Verdadeiro se >= :" },
+ { "If Equals", "Se Igual" },
+ { "If Not Equals", " Se Diferente" },
+ { "If Greater Than", "Se Maior Que" },
+ { "If Greater Than or Equal To", "Se Maior ou Igual Que" },
+ { "If Less Than", "Se Menor Que" },
+ { "If Less Than or Equal To", "Se Menor ou Igual Que" },
+ { "'Closed' if:", "'Fechado' se:" },
+ { "Move", "Mover" },
+ { "Read A/D Converter", "Ler Conversor A/D" },
+ { "Duty cycle var:", "Var Duty cycle:" },
+ { "Frequency (Hz):", "Frequencia (Hz):" },
+ { "Set PWM Duty Cycle", "Acionar PWM Duty Cycle" },
+ { "Source:", "Fonte:" },
+ { "Receive from UART", "Recebe da UART" },
+ { "Send to UART", "Envia para UART" },
+ { "Add", "Somar" },
+ { "Subtract", "Subtrair" },
+ { "Multiply", "Multiplicar" },
+ { "Divide", "Dividir" },
+ { "Destination:", "Destino:" },
+ { "is set := :", "esta acionado := :" },
+ { "Name:", "Nome:" },
+ { "Stages:", "Fases:" },
+ { "Shift Register", "Deslocar Registro" },
+ { "Not a reasonable size for a shift register.", "Não é um tamanho razoável para um registro de deslocamento." },
+ { "String:", "String:" },
+ { "Formatted String Over UART", "String Formatada para UART" },
+ { "Variable:", "Variavel:" },
+ { "Make Persistent", "Fazer Permanente" },
+ { "Too many elements in subcircuit!", "Excesso de elementos no SubCircuito!" },
+ { "Too many rungs!", "Muitas Linhas (rungs)!" },
+ { "Error", "Error" },
+ { "ANSI C target does not support peripherals (UART, PWM, ADC, EEPROM). Skipping that instruction.", "ANSI C não suporta periféricos (UART, PWM, ADC, EEPROM). Evite essas instruções." },
+ { "Compile successful; wrote C source code to '%s'.\r\n\r\nThis is not a complete C program. You have to provide the runtime and all the I/O routines. See the comments in the source code for information about how to do this.", "Compilação sucedida: Código Fonte escrito em C para '%s'.\r\n\r\nEste programa nao é completo em C. Você tem que fornecer o tempo de execução e de todas as rotinas de E/S. Veja os comentários no código fonte para mais informação sobre como fazer isto." },
+ { "Cannot delete rung; program must have at least one rung.", "Não pode apagar a Linha (rung); O programa deve contem pelo menos uma Linha (rung)." },
+ { "Out of memory; simplify program or choose microcontroller with more memory.", "Fora de Memória; Simplifique o programa ou escolha um microcontrolador com mais memória." },
+ { "Must assign pins for all ADC inputs (name '%s').", "Deve associar pinos para todas as entradas do ADC (nome '%s')." },
+ { "Internal limit exceeded (number of vars)", "Limite interno excedido (numero de variáveis)" },
+ { "Internal relay '%s' never assigned; add its coil somewhere.", "Rele Interno'%s' não foi associado; adicione esta bobina em outro lugar." },
+ { "Must assign pins for all I/O.\r\n\r\n'%s' is not assigned.", "Deve associar pinos a todas E/S.\r\n\r\n'%s' não esta associado." },
+ { "UART in use; pins %d and %d reserved for that.", "UART em uso; pinos %d e %d reservado para isso." },
+ { "PWM in use; pin %d reserved for that.", "PWM em uso; pino %d reservada para isso." },
+ { "UART baud rate generator: divisor=%d actual=%.4f for %.2f%% error.\r\n\r\nThis is too large; try a different baud rate (slower probably), or a crystal frequency chosen to be divisible by many common baud rates (e.g. 3.6864 MHz, 14.7456 MHz).\r\n\r\nCode will be generated anyways but serial may be unreliable or completely broken.", "Gerador UART baud rate: divisor=%d atual=%.4f para %.2f%% error.\r\n\r\nEste é muito grande; Tente com outro valor (provavelmente menor), ou um cristal cuja freqüência seja divisível pelos baud rate mais comuns (p.e. 3.6864MHz, 14.7456MHz).\r\n\r\nO código será gerado de qualquer maneira, porem a serial poderá ser incerta ou completamente fragmentada." },
+ { "UART baud rate generator: too slow, divisor overflows. Use a slower crystal or a faster baud rate.\r\n\r\nCode will be generated anyways but serial will likely be completely broken.", "Gerador UART baud rate: muito lento, divisor excedido. Use um cristal mais lento ou um baud rate maior.\r\n\r\nO código será gerado de qualquer maneira, porem a serial poderá ser incerta ou completamente fragmentada.." },
+ { "Couldn't open '%s'\n", "Não pode abrir '%s'\n" },
+ { "Timer period too short (needs faster cycle time).", "Período de Tempo muito curto (necessitara de um tempo de ciclo maior)." },
+ { "Timer period too long (max 32767 times cycle time); use a slower cycle time.", "Tempo do Temporizador muito grande(max. 32767 tempo de ciclo); use um tempo de ciclo menor." },
+ { "Constant %d out of range: -32768 to 32767 inclusive.", "Constante %d fora do range: -32768 a 32767 inclusive." },
+ { "Move instruction: '%s' not a valid destination.", "Instrução Mover: '%s' o destino não é válido." },
+ { "Math instruction: '%s' not a valid destination.", "Instruções Math: '%s' o destino não é válido." },
+ { "Piecewise linear lookup table with zero elements!", "Consulta da Tabela de Linearização por Segmentos com elementos zero!" },
+ { "x values in piecewise linear table must be strictly increasing.", "Os valores X na Tabela de Linearização por Segmentos deve ser estritamente incrementais." },
+ { "Numerical problem with piecewise linear lookup table. Either make the table entries smaller, or space the points together more closely.\r\n\r\nSee the help file for details.", "Problema numérico com a Tabela de Linearização por segmentos. Faça qualquer tabela com entradas menores. ou espace os pontos para mais pròximo.\r\n\r\nVeja em ajuda para mais detalhes." },
+ { "Multiple escapes (\\0-9) present in format string, not allowed.", "Não é permitido mais de um caractere especial (\\0-9) dentro da string formatada." },
+ { "Bad escape: correct form is \\xAB.", "Caractere Especial com Erro: A forma correta é \\xAB." },
+ { "Bad escape '\\%c'", "Caractere Especial com Erro '\\%c'" },
+ { "Variable is interpolated into formatted string, but none is specified.", "A variável é interpolada dentro da string formatada, mas nenhuma é especificado." },
+ { "No variable is interpolated into formatted string, but a variable name is specified. Include a string like '\\-3', or leave variable name blank.", "Nenhuma variável esta interpolada dentro da string formatada, porem um nome de variável é especificada. Inclua uma string como '\\-3', ou deixe o nome da variável em branco." },
+ { "Empty row; delete it or add instructions before compiling.", "Linha Vazia; apague ou adicione instruções antes de compilar." },
+ { "Couldn't write to '%s'", "Não pode ser gravado para '%s'." },
+ { "Unsupported op (anything ADC, PWM, UART, EEPROM) for interpretable target.", "Op não suportada no interpretador (algum ADC, PWM, UART, EEPROM)." },
+ { "Compile successful; wrote interpretable code to '%s'.\r\n\r\nYou probably have to adapt the interpreter to your application. See the documentation.", "Compilação sucedida: Código para interpretador escrito para '%s'.\r\n\r\nVocê provavelmente tem que adaptar o interpretador para sua aplicação. Veja a documentação." },
+ { "Microcontroller '%s' not supported.\r\n\r\nDefaulting to no selected MCU.", "Microcontrolador '%s' não suportado.\r\n\r\nFalha nenhum Micro selecionado." },
+ { "File format error; perhaps this program is for a newer version of LDmicro?", "Erro no formato de arquivo; talvez este programa é para uma versão mais nova do LDmicro?." },
+ { "Index:", "Índice:" },
+ { "Points:", "Pontos:" },
+ { "Count:", "Contador:" },
+ { "Edit table of ASCII values like a string", "Editar tabela do ASCII, valores como uma string" },
+ { "Look-Up Table", "Buscar na Tabela" },
+ { "Piecewise Linear Table", "Tabela de Linearização por Segmentos" },
+ { "LDmicro Error", "LDmicro Error" },
+ { "Compile Successful", "Compilação Sucedida" },
+ { "digital in", "entrada digital" },
+ { "digital out", "saída digital" },
+ { "int. relay", "rele interno" },
+ { "UART tx", "UART tx" },
+ { "UART rx", "UART rx" },
+ { "PWM out", "saída PWM" },
+ { "turn-on delay", "ativar atraso" },
+ { "turn-off delay", "desativar atraso" },
+ { "retentive timer", "temporizador com memória" },
+ { "counter", "contador" },
+ { "general var", "var geral" },
+ { "adc input", "entrada adc" },
+ { "<corrupt!>", "<corrompido!>" },
+ { "(not assigned)", "(sem atribuição)" },
+ { "<no UART!>", "<sem UART!>" },
+ { "<no PWM!>", "<sem PWM!>" },
+ { "TOF: variable cannot be used elsewhere", "TOF: a variável não pode ser usada em outra parte" },
+ { "TON: variable cannot be used elsewhere", "TON: a variável não pode ser usada em outra parte" },
+ { "RTO: variable can only be used for RES elsewhere", "RTO: a variável somente pode ser usada como RES em outra parte" },
+ { "Variable '%s' not assigned to, e.g. with a MOV statement, an ADD statement, etc.\r\n\r\nThis is probably a programming error; now it will always be zero.", "variável '%s' não atribuída, p.e. com o comando MOV, comando ADD, etc.\r\n\r\nIsto é provavelmente um erro de programação; será sempre zero." },
+ { "Variable for '%s' incorrectly assigned: %s.", "Variável para '%s' atribuída incorretamente : %s." },
+ { "Division by zero; halting simulation", "Divisão por zero; Parando simulação" },
+ { "!!!too long!!!", "!Muito longo!" },
+ { "\n\nI/O ASSIGNMENT:\n\n", "\n\nE/S ATRIBUIDA:\n\n" },
+ { " Name | Type | Pin\n", " Nome | Tipo | Pino\n" },
+ { "Serial (UART) will use pins %d and %d.\r\n\r\n", "A porta Serial (UART) usará os pinos %d e %d.\r\n\r\n" },
+};
+static Lang LangPt = {
+ LangPtTable, sizeof(LangPtTable)/sizeof(LangPtTable[0])
+};
+#endif
+#ifdef LDLANG_TR
+static LangTable LangTrTable[] = {
+ { "Target frequency %d Hz, closest achievable is %d Hz (warning, >5%% error).", "Hedef frekans %d Hz, bu deðere en yakýn olasý deðer %d Hz (Uyarý, >5% hatasý)." },
+ { "Compile successful; wrote IHEX for AVR to '%s'.\r\n\r\nRemember to set the processor configuration (fuses) correctly. This does not happen automatically.", "Derleme baþarýlý. AVR için derlenen '%s' IHEX dosyasýna kaydedildi.\r\n\r\n MÝB konfigürasyonunu ayarlamayý unutmayýn. Bu iþlem otomatik olarak yapýlmamaktadýr." },
+ { "( ) Normal", "( ) Normal" },
+ { "(/) Negated", "(/) Terslenmiþ" },
+ { "(S) Set-Only", "(S) Set" },
+ { "(R) Reset-Only", "(R) Reset" },
+ { "Pin on MCU", "MÝB Bacaðý" },
+ { "Coil", "Bobin" },
+ { "Comment", "Açýklama" },
+ { "Cycle Time (ms):", "Çevrim Süresi (ms):" },
+ { "Crystal Frequency (MHz):", "Kristal Frekansý (MHz):" },
+ { "UART Baud Rate (bps):", "UART Baud Rate (bps):" },
+ { "Serial (UART) will use pins %d and %d.\r\n\r\n", "Seri iletiþim için (UART) %d ve %d bacaklarý kullanýlacaktýr.\r\n\r\n" },
+ { "Please select a micro with a UART.\r\n\r\n", "Lütfen UART olan bir MÝB seçiniz.\r\n\r\n" },
+ { "No serial instructions (UART Send/UART Receive) are in use; add one to program before setting baud rate.\r\n\r\n", "Seri iletiþim komutu kullanmadýnýz. Hýzý ayarlamadan önce komut kullanmalýsýnýz.\r\n\r\n" },
+ { "The cycle time for the 'PLC' runtime generated by LDmicro is user-configurable. Very short cycle times may not be achievable due to processor speed constraints, and very long cycle times may not be achievable due to hardware overflows. Cycle times between 10 ms and 100 ms will usually be practical.\r\n\r\nThe compiler must know what speed crystal you are using with the micro to convert between timing in clock cycles and timing in seconds. A 4 MHz to 20 MHz crystal is typical; check the speed grade of the part you are using to determine the maximum allowable clock speed before choosing a crystal.", "PLC için LDMicro tarafýndan verilen çevrim süresi kullanýcý tarafýndan deðiþtirilebilir. Çok kýsa süreler iþlemcinin hýzýndan kaynaklanan sebeplerden dolayý verilemeyebilir. 10ms ile 100ms arasýndaki deðerler çevrim süresi için genellikle uygun deðerlerdir.\r\n\r\n.LDMicro kullanýlan kristalin hýzýný bilmelidir. Bu deðer program içerisinde kullanýlýr. Bilindiði üzere genellikle 4MHz ile 20MHz arasýnda deðere sahip kristaller kullanýlmaktadýr. Kullandýðýnýz kristalin deðerini ayarlamalýsýnýz." },
+ { "PLC Configuration", "PLC Ayarlarý" },
+ { "Zero cycle time not valid; resetting to 10 ms.", "Çevrim süresi sýfýr olamaz. 10ms olarak deðiþtirildi." },
+ { "Source", "Kaynak" },
+ { "Internal Relay", "Dahili Röle" },
+ { "Input pin", "Giriþ Bacaðý" },
+ { "Output pin", "Çýkýþ Bacaðý" },
+ { "|/| Negated", "|/| Terslenmiþ" },
+ { "Contacts", "Kontak" },
+ { "No ADC or ADC not supported for selected micro.", "Bu iþlemcide ADC yok yada ADC desteklenmiyor." },
+ { "Assign:", "Deðeri:" },
+ { "No microcontroller has been selected. You must select a microcontroller before you can assign I/O pins.\r\n\r\nSelect a microcontroller under the Settings menu and try again.", "Ýþlemci seçmediniz.\r\n\r\n G/Ç uçlarýný seçmeden önce Ayarlar menüsünden iþlemci seçiniz." },
+ { "I/O Pin Assignment", "G/Ç Bacak Tanýmý" },
+ { "Can't specify I/O assignment for ANSI C target; compile and see comments in generated source code.", "ANSI C hedef için G/Ç tanýmlamasý yapýlamadý. Dosyayý derleyerek oluþturulan kaynak kodundaki yorumlarý inceleyiniz." },
+ { "Can't specify I/O assignment for interpretable target; see comments in reference implementation of interpreter.", "Hedef için G/Ç tanýmý yapýlamadý. Derleyicinin kullaným kitapçýðýný inceleyiniz." },
+ { "Can only assign pin number to input/output pins (Xname or Yname or Aname).", "Sadece giriþ/çýkýþ uçlarý için bacak tanýmlamasý yapýlabilir. (XName veya YName veya AName)." },
+ { "No ADC or ADC not supported for this micro.", "Bu iþlemcide ADC yok yada ADC desteklenmiyor." },
+ { "Rename I/O from default name ('%s') before assigning MCU pin.", "('%s') öntanýmlý isimdir. MÝB bacaðý tanýmlamadan önce bu ismi deðiþtiriniz." },
+ { "I/O Pin", "G/Ç Bacaklarý" },
+ { "(no pin)", "(Bacak Yok)" },
+ { "<UART needs!>", "<UART gerekli!>" },
+ { "<PWM needs!>", "<PWM gerekli!>" },
+ { "<not an I/O!>", "<G/Ç deðil>" },
+ { "Export As Text", "Yazý dosyasý olarak ver" },
+ { "Couldn't write to '%s'.", "'%s' dosyasýna yazýlamadý." },
+ { "Compile To", "Derlenecek Yer" },
+ { "Must choose a target microcontroller before compiling.", "Derlemeden önce iþlemci seçilmelidir." },
+ { "UART function used but not supported for this micro.", "Komut kullanmýþsýnýz, ancak UART iþlemleri bu iþlemci için desteklenmiyor." },
+ { "PWM function used but not supported for this micro.", "Komut kullanmýþsýnýz, ancak PWM iþlemleri bu iþlemci için desteklenmiyor." },
+ { "The program has changed since it was last saved.\r\n\r\nDo you want to save the changes?", "Dosyada deðiþiklik yaptýnýz.\r\n\r\n Kaydetmek ister misiniz?" },
+ { "--add comment here--", "--aciklamanizi buraya ekleyiniz--" },
+ { "Start new program?", "Yeni dosya oluþturulsun mu?" },
+ { "Couldn't open '%s'.", "'%s' dosyasýna kayýt yapýlamýyor." },
+ { "Name", "Ýsim" },
+ { "State", "Durum/Deðer" },
+ { "Pin on Processor", "Ýþlemci Bacak No" },
+ { "MCU Port", "Ýþlemci Portu" },
+ { "LDmicro - Simulation (Running)", "LDmicro - Simülasyon (Çalýþýyor)" },
+ { "LDmicro - Simulation (Stopped)", "LDmicro - Simülasyon (Durduruldu)" },
+ { "LDmicro - Program Editor", "LDmicro – Program Editörü " },
+ { " - (not yet saved)", " - (deðiþiklikler kaydedilmedi)" },
+ { "&New\tCtrl+N", "&Yeni Dosya\tCtrl+N" },
+ { "&Open...\tCtrl+O", "&Dosya Aç\tCtrl+O" },
+ { "&Save\tCtrl+S", "&Dosyayý Kaydet\tCtrl+S" },
+ { "Save &As...", "Dosyayý Farklý Kaydet" },
+ { "&Export As Text...\tCtrl+E", "&Metin Dosyasý Olarak Kaydet\tCtrl+E" },
+ { "E&xit", "Çýkýþ" },
+ { "&Undo\tCtrl+Z", "Deðiþikliði Geri Al\tCtrl+Z" },
+ { "&Redo\tCtrl+Y", "&Deðiþikliði Tekrarla\tCtrl+Y" },
+ { "Insert Rung &Before\tShift+6", "Üst kýsma satýr (Rung) ekle\tShift+6" },
+ { "Insert Rung &After\tShift+V", "Alt kýsma satýr (Rung) ekle\tShift+V" },
+ { "Move Selected Rung &Up\tShift+Up", "Seçili satýrý üste taþý\tShift+Up" },
+ { "Move Selected Rung &Down\tShift+Down", "Seçili satýrý alta taþý\tShift+Down" },
+ { "&Delete Selected Element\tDel", "&Seçili Elemaný Sil\tDel" },
+ { "D&elete Rung\tShift+Del", "Seçili Satýrý Sil\tShift+Del" },
+ { "Insert Co&mment\t;", "Açýklama Ekle\t;" },
+ { "Insert &Contacts\tC", "Kontak Eekle\tC" },
+ { "Insert OSR (One Shot Rising)\t&/", "OSR ekle (Yükselen Kenar)\t&/" },
+ { "Insert OSF (One Shot Falling)\t&\\", "OSF ekle (Düþen Kenar)\t&\\" },
+ { "Insert T&ON (Delayed Turn On)\tO", "T&ON ekle (Turn-On Gecikme)\tO" },
+ { "Insert TO&F (Delayed Turn Off)\tF", "T&OF ekle (Turn-Off Gecikme)\tF" },
+ { "Insert R&TO (Retentive Delayed Turn On)\tT", "R&TO ekle (Süre Sayan Turn-On Gecikme)\tT" },
+ { "Insert CT&U (Count Up)\tU", "CT&U ekle (Yukarý Sayýcý)\tU" },
+ { "Insert CT&D (Count Down)\tI", "CT&D ekle (Aþaðý Sayýcý)\tI" },
+ { "Insert CT&C (Count Circular)\tJ", "CT&C ekle (Döngüsel Sayýcý)\tJ" },
+ { "Insert EQU (Compare for Equals)\t=", "EQU ekle (Eþitlik Kontrolü)\t=" },
+ { "Insert NEQ (Compare for Not Equals)", "NEQ ekle (Farklýlýk Kontrolü)" },
+ { "Insert GRT (Compare for Greater Than)\t>", "GRT ekle (Büyük Kontrolü)\t>" },
+ { "Insert GEQ (Compare for Greater Than or Equal)\t.", "GEQ ekle (Büyük yada Eþit Kontrolü)\t." },
+ { "Insert LES (Compare for Less Than)\t<", "LES ekle (Küçük Kontrolü)\t<" },
+ { "Insert LEQ (Compare for Less Than or Equal)\t,", "LEQ ekle (Küçük yada Eþit Kontrolü)\t," },
+ { "Insert Open-Circuit", "Açýk Devre ekle" },
+ { "Insert Short-Circuit", "Kapalý Devre ekle" },
+ { "Insert Master Control Relay", "Ana Kontrol Rölesi ekle" },
+ { "Insert Coi&l\tL", "Bobin ek&le\tL" },
+ { "Insert R&ES (Counter/RTO Reset)\tE", "R&ES ekle (RTO/Sayýcý Sýfýrlamasý)\tE" },
+ { "Insert MOV (Move)\tM", "MOV (Taþý) ekle\tM" },
+ { "Insert ADD (16-bit Integer Add)\t+", "ADD (16 bit Toplama)ekle\t+" },
+ { "Insert SUB (16-bit Integer Subtract)\t-", "SUB (16 bit çýkarma) ekle\t-" },
+ { "Insert MUL (16-bit Integer Multiply)\t*", "MUL (16 bit çarpma) ekle\t*" },
+ { "Insert DIV (16-bit Integer Divide)\tD", "DIV (16 bit bölme) ekle\tD" },
+ { "Insert Shift Register", "Shift Register ekle" },
+ { "Insert Look-Up Table", "Deðer Tablosu ekle" },
+ { "Insert Piecewise Linear", "Parçalý Lineer ekle" },
+ { "Insert Formatted String Over UART", "UART Üzerinden Biçimlendirilmiþ Kelime Ekle" },
+ { "Insert &UART Send", "&UART'dan Gönderme ekle" },
+ { "Insert &UART Receive", "&UART'dan Alma ekle" },
+ { "Insert Set PWM Output", "PWM Çýkýþý Akit Et ekle" },
+ { "Insert A/D Converter Read\tP", "A/D Çeviriciden Oku ekle\tP" },
+ { "Insert Make Persistent", "EPROM'da Sakla ekle" },
+ { "Make Norm&al\tA", "Normale Çevir\tA" },
+ { "Make &Negated\tN", "Terslenmiþ Yap\tN" },
+ { "Make &Set-Only\tS", "Set Yap\tS" },
+ { "Make &Reset-Only\tR", "Reset Yap\tR" },
+ { "&MCU Parameters...", "&Ýþlemci Ayarlarý..." },
+ { "(no microcontroller)", "(iþlemci yok)" },
+ { "&Microcontroller", "Ýþlemci Seçimi" },
+ { "Si&mulation Mode\tCtrl+M", "Si&mülasyon Modu\tCtrl+M" },
+ { "Start &Real-Time Simulation\tCtrl+R", "Ge&rçek Zamanlý Simülasyonu Baþlat\tCtrl+R" },
+ { "&Halt Simulation\tCtrl+H", "Simülasyonu Durdur\tCtrl+H" },
+ { "Single &Cycle\tSpace", "Satýr Satýr Simülasyon\tEspace" },
+ { "&Compile\tF5", "&Derle\tF5" },
+ { "Compile &As...", "Farklý Derle..." },
+ { "&Manual...\tF1", "&Kitapçýk...\tF1" },
+ { "&About...", "&Bilgi..." },
+ { "&File", "&Dosya" },
+ { "&Edit", "&Düzen" },
+ { "&Settings", "&Ayarlar" },
+ { "&Instruction", "K&omutlar" },
+ { "Si&mulate", "Si&mülasyon" },
+ { "&Compile", "&Derle" },
+ { "&Help", "&Yardým" },
+ { "no MCU selected", "Ýþlemci Seçilmedi" },
+ { "cycle time %.2f ms", "çevrim süresi %.2f ms" },
+ { "processor clock %.4f MHz", "iþlemci frekansý %.4f MHz" },
+ { "Internal error relating to PIC paging; make program smaller or reshuffle it.", "PIC sayfalamasý ile ilgili dahili hata oluþtu. Programý kýsaltýnýz yada deðiþtiriniz." },
+ { "PWM frequency too fast.", "PWM frekansý çok hýzlý." },
+ { "PWM frequency too slow.", "PWM frekansý çok yavaþ." },
+ { "Cycle time too fast; increase cycle time, or use faster crystal.", "Çevrim süresi çok kýsa. Süreyi yada kristal frekansýný artýrýnýz." },
+ { "Cycle time too slow; decrease cycle time, or use slower crystal.", "Çevrim süresi çok uzun. Süreyi yada kristal frekansýný azaltýnýz.." },
+ { "Couldn't open file '%s'", "'%s' dosyasý açýlamadý." },
+ { "Zero baud rate not possible.", "Ýletiþim hýzý (Baudrate) sýfýr olamaz." },
+ { "Compile successful; wrote IHEX for PIC16 to '%s'.\r\n\r\nConfiguration word (fuses) has been set for crystal oscillator, BOD enabled, LVP disabled, PWRT enabled, all code protection off.\r\n\r\nUsed %d/%d words of program flash (chip %d%% full).", "Derleme baþarýyla yapýldý; PIC16 için IHEX dosyasý '%s' dosyasýna kaydedildi.\r\n\r\nAyarlar: (PIC konfigürasyonu) kristal osilatör, BOD aktif, LVP pasif, PWRT aktif, tüm kod korumasý kapalý.\r\n\r\nPIC hafýzasýnýn %d/%d kelimesi kullanýldý. (Hafýza %d%% dolu)." },
+ { "Type", "Tipi" },
+ { "Timer", "Zamanlayýcý" },
+ { "Counter", "Sayýcý" },
+ { "Reset", "Reset" },
+ { "OK", "Tamam" },
+ { "Cancel", "Vazgeç" },
+ { "Empty textbox; not permitted.", "Yazý kutusu boþ olamaz" },
+ { "Bad use of quotes: <%s>", "Týrnaklar yanlýþ kullanýlmýþ: <%s>" },
+ { "Turn-On Delay", "Turn-On Gecikme Devresi" },
+ { "Turn-Off Delay", "Turn-Off Gecikme Devresi" },
+ { "Retentive Turn-On Delay", "Deðeri Saklanan Turn-On Gecikme" },
+ { "Delay (ms):", "Gecikme (ms):" },
+ { "Delay too long; maximum is 2**31 us.", "Gecikme çok fazla. En fazla 2**31 us olabilir." },
+ { "Delay cannot be zero or negative.", "Gecikme sýfýr yada eksi deðer olamaz." },
+ { "Count Up", "Yukarý Say" },
+ { "Count Down", "Aþaðý Say" },
+ { "Circular Counter", "Dairesel Sayýcý" },
+ { "Max value:", "En Yüksek Deðer:" },
+ { "True if >= :", "Doðru Eðer >= :" },
+ { "If Equals", "Eþitse" },
+ { "If Not Equals", "Eþit Deðilse" },
+ { "If Greater Than", "Büyükse" },
+ { "If Greater Than or Equal To", "Büyük yada Eþitse" },
+ { "If Less Than", "Küçükse" },
+ { "If Less Than or Equal To", "Küçük yada Eþitse" },
+ { "'Closed' if:", "'Kapalý' Eðer:" },
+ { "Move", "Taþý" },
+ { "Read A/D Converter", "A/D Çeviriciyi Oku" },
+ { "Duty cycle var:", "Pals Geniþliði Deðeri:" },
+ { "Frequency (Hz):", "Frekans (Hz):" },
+ { "Set PWM Duty Cycle", "PWM Pals Geniþliði Deðeri" },
+ { "Source:", "Kaynak:" },
+ { "Receive from UART", "UART'dan bilgi al" },
+ { "Send to UART", "UART'dan bilgi gönder" },
+ { "Add", "Topla" },
+ { "Subtract", "Çýkar" },
+ { "Multiply", "Çarp" },
+ { "Divide", "Böl" },
+ { "Destination:", "Hedef:" },
+ { "is set := :", "Verilen Deðer := :" },
+ { "Name:", "Ýsim:" },
+ { "Stages:", "Aþamalar:" },
+ { "Shift Register", "Shift Register" },
+ { "Not a reasonable size for a shift register.", "Shift Register için kabul edilebilir deðer deðil." },
+ { "String:", "Karakter Dizisi:" },
+ { "Formatted String Over UART", "UART Üzerinden Biçimlendirilmiþ Karakter Dizisi" },
+ { "Variable:", "Deðiþken:" },
+ { "Make Persistent", "EEPROM'da Sakla" },
+ { "Too many elements in subcircuit!", "Alt devrede çok fazla eleman var!" },
+ { "Too many rungs!", "Satýr sayýsý (Rung) fazla!" },
+ { "Error", "Hata" },
+ { "ANSI C target does not support peripherals (UART, PWM, ADC, EEPROM). Skipping that instruction.", "ANSI C hedef özellikleri desteklemiyor.(UART, ADC, EEPROM). Ýlgili komutlar iþlenmeyecek." },
+ { "Compile successful; wrote C source code to '%s'.\r\n\r\nThis is not a complete C program. You have to provide the runtime and all the I/O routines. See the comments in the source code for information about how to do this.", "Derleme baþarýyla tamamlandý. C kaynak kodu '%s' dosyasýna yazýldý.\r\n\r\nBu dosya tam bir C dosyasý deðildir. G/Ç rutinlerini kendiniz saðlamalýsýnýz. Dosyayý incelemeniz faydalý olacaktýr." },
+ { "Cannot delete rung; program must have at least one rung.", "Bu satýr silinemez. Programda en az bir tane satýr (Rung) olmalýdýr." },
+ { "Out of memory; simplify program or choose microcontroller with more memory.", "ÝÞlemci hafýzasý doldu; Programý kýsaltýnýz yada daha yüksek hafýzasý olan bir iþlemci seçiniz." },
+ { "Must assign pins for all ADC inputs (name '%s').", "Tüm ADC giriþlerinin bacaklarý belirtilmelidir (ADC '%s')." },
+ { "Internal limit exceeded (number of vars)", "Dahili sýnýr aþýldý (Deðiþken Sayýsý)" },
+ { "Internal relay '%s' never assigned; add its coil somewhere.", "'%s' dahili rölesine deðer verilmedi, Bu röle için bir bobin ekleyiniz." },
+ { "Must assign pins for all I/O.\r\n\r\n'%s' is not assigned.", "Tüm G/Ç uçlarý için bacaklar belirtilmelidir.\r\n\r\n'%s' ucuna deðer verilmemiþ." },
+ { "UART in use; pins %d and %d reserved for that.", "UART Kullanýmda; %d ve %d bacaklarý bunun için kullanýlmaktadýr. Siz kullanamazsýnýz." },
+ { "PWM in use; pin %d reserved for that.", "PWM Kullanýmda; %d bacaðý bunun için ayrýlmýþtýr. Siz kullanamazsýnýz.." },
+ { "UART baud rate generator: divisor=%d actual=%.4f for %.2f%% error.\r\n\r\nThis is too large; try a different baud rate (slower probably), or a crystal frequency chosen to be divisible by many common baud rates (e.g. 3.6864 MHz, 14.7456 MHz).\r\n\r\nCode will be generated anyways but serial may be unreliable or completely broken.", "UART Hýz Hesaplayýcýsý: Bölen=%d Gerçekte=%.4f (%.2f%% hata payý ile).\r\n\r\nBu deðer çok yüksektir. Deðiþik bir deðer denemelisiniz yada kristal frekansýný sýk kullanýlan ve bu deðerlere bölünebilen bir deðer seçiniz. (Mesela 3.6864MHz, 14.7456MHz gibi).\r\n\r\nHer durumda kod oluþturulacaktýr; ancak seri iletiþim düzgün çalýþmayabilir yada tamamen durabilir." },
+ { "UART baud rate generator: too slow, divisor overflows. Use a slower crystal or a faster baud rate.\r\n\r\nCode will be generated anyways but serial will likely be completely broken.", "UART Hýz Hesaplayýcýsý: Hýz çok düþük. Bu nedenle bölen taþma yapýyor. Ya kristal frekansýný düþürünüz yada hýzý (baudrate) artýrýnýz.\r\n\r\nHer durumda kod oluþturulacaktýr; ancak seri iletiþim düzgün çalýþmayabilir yada tamamen durabilir." },
+ { "Couldn't open '%s'\n", "'%s' dosyasý açýlamadý\n" },
+ { "Timer period too short (needs faster cycle time).", "Zamanlayýcý peryodu çok kýsa (daha yüksek çevrim süresi gerekli)." },
+ { "Timer period too long (max 32767 times cycle time); use a slower cycle time.", "Zamanlayýcý peryodu çok kýsa(en fazla. çevrim süresinin 32767 katý olabilir); çevrim süresini düþürünüz." },
+ { "Constant %d out of range: -32768 to 32767 inclusive.", "%d sabiti aralýðýn dýþýnda: -32768 ile 32767 arasýnda olmalýdýr." },
+ { "Move instruction: '%s' not a valid destination.", "Taþýma Komutu: '%s' geçerli bir hedef adresi deðil." },
+ { "Math instruction: '%s' not a valid destination.", "Matematik Komutu: '%s'geçerli bir hedef adresi deðil." },
+ { "Piecewise linear lookup table with zero elements!", "Parçalý doðrusal arama tablosunda deðer yok!" },
+ { "x values in piecewise linear table must be strictly increasing.", "Parçalý doðrusal arama tablosundaki x deðerleri artan sýralamalý olmalý." },
+ { "Numerical problem with piecewise linear lookup table. Either make the table entries smaller, or space the points together more closely.\r\n\r\nSee the help file for details.", "Parçalý doðrusal arama tablosunda sayýsal hata.\r\n\r\nDetaylar için yardým menüsünü inceleyiniz." },
+ { "Multiple escapes (\\0-9) present in format string, not allowed.", "Biçimli karakter dizisinde birden çok escape kodu var(\\0-9)." },
+ { "Bad escape: correct form is \\xAB.", "Yanlýþ ESC komutu: doðru þekil = \\xAB." },
+ { "Bad escape '\\%c'", "Yanlýþ ESC komutu '\\%c'" },
+ { "Variable is interpolated into formatted string, but none is specified.", "Biçimlendirilmiþ karakter kümesine deðiþken tanýmlanmýþ ama hiç belirtilmemiþ." },
+ { "No variable is interpolated into formatted string, but a variable name is specified. Include a string like '\\-3', or leave variable name blank.", "Biçimlendirilmiþ karakter kümesine deðiþken atanmamýþ ama deðiþken ismi belirtilmiþ. Ya deðiþken ismini belirtiniz yada '\\-3' gibi bir deðer veriniz.." },
+ { "Empty row; delete it or add instructions before compiling.", "Satýr boþ; Satýrý silmeli yada komut eklemelisiniz." },
+ { "Couldn't write to '%s'", "'%s' dosyasýna kayýt yapýlamýyor." },
+ { "Unsupported op (anything ADC, PWM, UART, EEPROM) for interpretable target.", "Komut desteklenmiyor. (ADC, PWM, UART, EEPROM ile ilgili komutlardan herhangi biri)" },
+ { "Compile successful; wrote interpretable code to '%s'.\r\n\r\nYou probably have to adapt the interpreter to your application. See the documentation.", "Derleme baþarýyla tamamlandý. Kod '%s' dosyasýna yazýldý.\r\n\r\nDerleyiciyi uygulamanýza göre deðiþtirmeniz gerekebilir. Geniþ bilgi için LDMicro belgelerine baþvurabilirsiniz." },
+ { "Microcontroller '%s' not supported.\r\n\r\nDefaulting to no selected MCU.", "'%s' desteklenen bir iþlemci deðil.\r\n\r\nÝþlemci ayarý iþlemci yok þeklinde deðiþtirilmiþtir." },
+ { "File format error; perhaps this program is for a newer version of LDmicro?", "Dosya biçimi hatasý. Açmaya çalýþtýðýnýz dosya ya LDMicro dosyasý deðil yada yeni bir sürüm ile yazýlmýþ." },
+ { "Index:", "Liste:" },
+ { "Points:", "Deðer Sayýsý:" },
+ { "Count:", "Adet:" },
+ { "Edit table of ASCII values like a string", "ASCII deðer tablosunu karakter dizisi gibi düzenle." },
+ { "Look-Up Table", "Arama Tablosu" },
+ { "Piecewise Linear Table", "Parçalý Lineer Tablo" },
+ { "LDmicro Error", "LDmicro Hatasý" },
+ { "Compile Successful", "Derleme Baþarýlý" },
+ { "digital in", "Dijital Giriþ" },
+ { "digital out", "Dijital Çýkýþ" },
+ { "int. relay", "Dahili Röle" },
+ { "UART tx", "UART tx" },
+ { "UART rx", "UART rx" },
+ { "PWM out", "PWM Çýkýþý" },
+ { "turn-on delay", "Turn-On Gecikme" },
+ { "turn-off delay", "Turn-Off Gecikme" },
+ { "retentive timer", "deðeri saklanan zamanlayýcý" },
+ { "counter", "Sayýcý" },
+ { "general var", "Genel Deðiþken" },
+ { "adc input", "ADC Giriþi" },
+ { "<corrupt!>", "<bozuk>" },
+ { "(not assigned)", "(tanýmlý deðil)" },
+ { "<no UART!>", "<UART Yok!>" },
+ { "<no PWM!>", "<PWM Yok!>" },
+ { "TOF: variable cannot be used elsewhere", "TOF: Deðiþken baþka bir yerde kullanýlamaz" },
+ { "TON: variable cannot be used elsewhere", "TON: Deðiþken baþka bir yerde kullanýlamaz" },
+ { "RTO: variable can only be used for RES elsewhere", "RTO: Deðiþken sadece RES için kullanýlabilir" },
+ { "Variable '%s' not assigned to, e.g. with a MOV statement, an ADD statement, etc.\r\n\r\nThis is probably a programming error; now it will always be zero.", "'%s' deðer atanmamýþ.Örneðin, MOV, ADD komutlarý ile deðer atanabilir.\r\n\r\nMuhtemelen bu bir programlama hatasýdýr. Bu nedenle deðiþkenin deðeri 0 olarak kullanýlacaktýr." },
+ { "Variable for '%s' incorrectly assigned: %s.", "'%s' için deðiþken hatalý atanmýþ: %s." },
+ { "Division by zero; halting simulation", "Sýfýra bölüm; Simülasyon durduruldu." },
+ { "!!!too long!!!", "!!!çok uzun!!" },
+ { "\n\nI/O ASSIGNMENT:\n\n", "\n\nG/Ç TANIMI:\n\n" },
+ { " Name | Type | Pin\n", " Ýsim | Tipi | Bacak\n" },
+};
+static Lang LangTr = {
+ LangTrTable, sizeof(LangTrTable)/sizeof(LangTrTable[0])
+};
+#endif
diff --git a/ldmicro/pic16.cpp b/ldmicro/pic16.cpp index ae815fe..a813420 100644 --- a/ldmicro/pic16.cpp +++ b/ldmicro/pic16.cpp @@ -22,7 +22,7 @@ // runtime needed to schedule the cycles. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <math.h> #include <stdio.h> #include <setjmp.h> diff --git a/ldmicro/resetdialog.cpp b/ldmicro/resetdialog.cpp index 00421d5..b83cd42 100644 --- a/ldmicro/resetdialog.cpp +++ b/ldmicro/resetdialog.cpp @@ -21,9 +21,9 @@ // which can be that of either a timer or a counter. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> -#include <commctrl.h> +//#include <commctrl.h> #include "ldmicro.h" diff --git a/ldmicro/schematic.cpp b/ldmicro/schematic.cpp index 84be7b6..849093e 100644 --- a/ldmicro/schematic.cpp +++ b/ldmicro/schematic.cpp @@ -21,7 +21,7 @@ // Actual manipulation of circuit elements happens in circuit.cpp, though. // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> @@ -83,43 +83,43 @@ BOOL FindSelected(int *gx, int *gy) //----------------------------------------------------------------------------- void SelectElement(int gx, int gy, int state) { - if(gx < 0 || gy < 0) { - if(!FindSelected(&gx, &gy)) { - return; - } - } - - if(Selected) Selected->selectedState = SELECTED_NONE; - - Selected = DisplayMatrix[gx][gy]; - SelectedWhich = DisplayMatrixWhich[gx][gy]; - - if(SelectedWhich == ELEM_PLACEHOLDER) { - state = SELECTED_LEFT; - } - - if((gy - ScrollYOffset) >= ScreenRowsAvailable()) { - ScrollYOffset = gy - ScreenRowsAvailable() + 1; - RefreshScrollbars(); - } - if((gy - ScrollYOffset) < 0) { - ScrollYOffset = gy; - RefreshScrollbars(); - } - if((gx - ScrollXOffset*POS_WIDTH*FONT_WIDTH) >= ScreenColsAvailable()) { - ScrollXOffset = gx*POS_WIDTH*FONT_WIDTH - ScreenColsAvailable(); - RefreshScrollbars(); - } - if((gx - ScrollXOffset*POS_WIDTH*FONT_WIDTH) < 0) { - ScrollXOffset = gx*POS_WIDTH*FONT_WIDTH; - RefreshScrollbars(); - } - - ok(); - Selected->selectedState = state; - ok(); - - WhatCanWeDoFromCursorAndTopology(); +// if(gx < 0 || gy < 0) { +// if(!FindSelected(&gx, &gy)) { +// return; +// } +// } + +// if(Selected) Selected->selectedState = SELECTED_NONE; + +// Selected = DisplayMatrix[gx][gy]; +// SelectedWhich = DisplayMatrixWhich[gx][gy]; + +// if(SelectedWhich == ELEM_PLACEHOLDER) { +// state = SELECTED_LEFT; +// } + +// if((gy - ScrollYOffset) >= ScreenRowsAvailable()) { +// ScrollYOffset = gy - ScreenRowsAvailable() + 1; +// RefreshScrollbars(); +// } +// if((gy - ScrollYOffset) < 0) { +// ScrollYOffset = gy; +// RefreshScrollbars(); +// } +// if((gx - ScrollXOffset*POS_WIDTH*FONT_WIDTH) >= ScreenColsAvailable()) { +// ScrollXOffset = gx*POS_WIDTH*FONT_WIDTH - ScreenColsAvailable(); +// RefreshScrollbars(); +// } +// if((gx - ScrollXOffset*POS_WIDTH*FONT_WIDTH) < 0) { +// ScrollXOffset = gx*POS_WIDTH*FONT_WIDTH; +// RefreshScrollbars(); +// } + +// ok(); +// Selected->selectedState = state; +// ok(); + +// WhatCanWeDoFromCursorAndTopology(); } //----------------------------------------------------------------------------- @@ -129,86 +129,86 @@ void SelectElement(int gx, int gy, int state) //----------------------------------------------------------------------------- void WhatCanWeDoFromCursorAndTopology(void) { - BOOL canNegate = FALSE, canNormal = FALSE; - BOOL canResetOnly = FALSE, canSetOnly = FALSE; - BOOL canPushUp = TRUE, canPushDown = TRUE; - - BOOL canDelete = TRUE; - - int i = RungContainingSelected(); - if(i >= 0) { - if(i == 0) canPushUp = FALSE; - if(i == (Prog.numRungs-1)) canPushDown = FALSE; - - if(Prog.rungs[i]->count == 1 && - Prog.rungs[i]->contents[0].which == ELEM_PLACEHOLDER) - { - canDelete = FALSE; - } - } - - CanInsertEnd = FALSE; - CanInsertOther = TRUE; - - if(Selected && - (SelectedWhich == ELEM_COIL || - SelectedWhich == ELEM_RES || - SelectedWhich == ELEM_ADD || - SelectedWhich == ELEM_SUB || - SelectedWhich == ELEM_MUL || - SelectedWhich == ELEM_DIV || - SelectedWhich == ELEM_CTC || - SelectedWhich == ELEM_READ_ADC || - SelectedWhich == ELEM_SET_PWM || - SelectedWhich == ELEM_MASTER_RELAY || - SelectedWhich == ELEM_SHIFT_REGISTER || - SelectedWhich == ELEM_LOOK_UP_TABLE || - SelectedWhich == ELEM_PIECEWISE_LINEAR || - SelectedWhich == ELEM_PERSIST || - SelectedWhich == ELEM_MOVE)) - { - if(SelectedWhich == ELEM_COIL) { - canNegate = TRUE; - canNormal = TRUE; - canResetOnly = TRUE; - canSetOnly = TRUE; - } - - if(Selected->selectedState == SELECTED_ABOVE || - Selected->selectedState == SELECTED_BELOW) - { - CanInsertEnd = TRUE; - CanInsertOther = FALSE; - } else if(Selected->selectedState == SELECTED_RIGHT) { - CanInsertEnd = FALSE; - CanInsertOther = FALSE; - } - } else if(Selected) { - if(Selected->selectedState == SELECTED_RIGHT || - SelectedWhich == ELEM_PLACEHOLDER) - { - CanInsertEnd = ItemIsLastInCircuit(Selected); - } - } - if(SelectedWhich == ELEM_CONTACTS) { - canNegate = TRUE; - canNormal = TRUE; - } - if(SelectedWhich == ELEM_PLACEHOLDER) { - // a comment must be the only element in its rung, and it will fill - // the rung entirely - CanInsertComment = TRUE; - } else { - CanInsertComment = FALSE; - } - if(SelectedWhich == ELEM_COMMENT) { - // if there's a comment there already then don't let anything else - // into the rung - CanInsertEnd = FALSE; - CanInsertOther = FALSE; - } - SetMenusEnabled(canNegate, canNormal, canResetOnly, canSetOnly, canDelete, - CanInsertEnd, CanInsertOther, canPushDown, canPushUp, CanInsertComment); +// BOOL canNegate = FALSE, canNormal = FALSE; +// BOOL canResetOnly = FALSE, canSetOnly = FALSE; +// BOOL canPushUp = TRUE, canPushDown = TRUE; + +// BOOL canDelete = TRUE; + +// int i = RungContainingSelected(); +// if(i >= 0) { +// if(i == 0) canPushUp = FALSE; +// if(i == (Prog.numRungs-1)) canPushDown = FALSE; + +// if(Prog.rungs[i]->count == 1 && +// Prog.rungs[i]->contents[0].which == ELEM_PLACEHOLDER) +// { +// canDelete = FALSE; +// } +// } + +// CanInsertEnd = FALSE; +// CanInsertOther = TRUE; + +// if(Selected && +// (SelectedWhich == ELEM_COIL || +// SelectedWhich == ELEM_RES || +// SelectedWhich == ELEM_ADD || +// SelectedWhich == ELEM_SUB || +// SelectedWhich == ELEM_MUL || +// SelectedWhich == ELEM_DIV || +// SelectedWhich == ELEM_CTC || +// SelectedWhich == ELEM_READ_ADC || +// SelectedWhich == ELEM_SET_PWM || +// SelectedWhich == ELEM_MASTER_RELAY || +// SelectedWhich == ELEM_SHIFT_REGISTER || +// SelectedWhich == ELEM_LOOK_UP_TABLE || +// SelectedWhich == ELEM_PIECEWISE_LINEAR || +// SelectedWhich == ELEM_PERSIST || +// SelectedWhich == ELEM_MOVE)) +// { +// if(SelectedWhich == ELEM_COIL) { +// canNegate = TRUE; +// canNormal = TRUE; +// canResetOnly = TRUE; +// canSetOnly = TRUE; +// } + +// if(Selected->selectedState == SELECTED_ABOVE || +// Selected->selectedState == SELECTED_BELOW) +// { +// CanInsertEnd = TRUE; +// CanInsertOther = FALSE; +// } else if(Selected->selectedState == SELECTED_RIGHT) { +// CanInsertEnd = FALSE; +// CanInsertOther = FALSE; +// } +// } else if(Selected) { +// if(Selected->selectedState == SELECTED_RIGHT || +// SelectedWhich == ELEM_PLACEHOLDER) +// { +// CanInsertEnd = ItemIsLastInCircuit(Selected); +// } +// } +// if(SelectedWhich == ELEM_CONTACTS) { +// canNegate = TRUE; +// canNormal = TRUE; +// } +// if(SelectedWhich == ELEM_PLACEHOLDER) { +// // a comment must be the only element in its rung, and it will fill +// // the rung entirely +// CanInsertComment = TRUE; +// } else { +// CanInsertComment = FALSE; +// } +// if(SelectedWhich == ELEM_COMMENT) { +// // if there's a comment there already then don't let anything else +// // into the rung +// CanInsertEnd = FALSE; +// CanInsertOther = FALSE; +// } +// SetMenusEnabled(canNegate, canNormal, canResetOnly, canSetOnly, canDelete, +// CanInsertEnd, CanInsertOther, canPushDown, canPushUp, CanInsertComment); } //----------------------------------------------------------------------------- @@ -250,33 +250,33 @@ void ForgetEverything(void) //----------------------------------------------------------------------------- BOOL MoveCursorTopLeft(void) { - int i, j; - // Let us first try to place it somewhere on-screen, so start at the - // vertical scroll offset, not the very top (to avoid placing the - // cursor in a position that would force us to scroll to put it in to - // view.) - for(i = 0; i < DISPLAY_MATRIX_X_SIZE; i++) { - for(j = ScrollYOffset; - j < DISPLAY_MATRIX_Y_SIZE && j < (ScrollYOffset+16); j++) - { - if(VALID_LEAF(DisplayMatrix[i][j])) { - SelectElement(i, j, SELECTED_LEFT); - return TRUE; - } - } - } - - // If that didn't work, then try anywhere on the diagram before giving - // up entirely. - for(i = 0; i < DISPLAY_MATRIX_X_SIZE; i++) { - for(j = 0; j < 16; j++) { - if(VALID_LEAF(DisplayMatrix[i][j])) { - SelectElement(i, j, SELECTED_LEFT); - return TRUE; - } - } - } - return FALSE; +// int i, j; +// // Let us first try to place it somewhere on-screen, so start at the +// // vertical scroll offset, not the very top (to avoid placing the +// // cursor in a position that would force us to scroll to put it in to +// // view.) +// for(i = 0; i < DISPLAY_MATRIX_X_SIZE; i++) { +// for(j = ScrollYOffset; +// j < DISPLAY_MATRIX_Y_SIZE && j < (ScrollYOffset+16); j++) +// { +// if(VALID_LEAF(DisplayMatrix[i][j])) { +// SelectElement(i, j, SELECTED_LEFT); +// return TRUE; +// } +// } +// } + +// // If that didn't work, then try anywhere on the diagram before giving +// // up entirely. +// for(i = 0; i < DISPLAY_MATRIX_X_SIZE; i++) { +// for(j = 0; j < 16; j++) { +// if(VALID_LEAF(DisplayMatrix[i][j])) { +// SelectElement(i, j, SELECTED_LEFT); +// return TRUE; +// } +// } +// } +// return FALSE; } //----------------------------------------------------------------------------- @@ -287,108 +287,108 @@ BOOL MoveCursorTopLeft(void) //----------------------------------------------------------------------------- void MoveCursorKeyboard(int keyCode) { - if(!Selected || Selected->selectedState == SELECTED_NONE) { - MoveCursorTopLeft(); - return; - } - - switch(keyCode) { - case VK_LEFT: { - if(!Selected || Selected->selectedState == SELECTED_NONE) { - break; - } - if(Selected->selectedState != SELECTED_LEFT) { - SelectElement(-1, -1, SELECTED_LEFT); - break; - } - if(SelectedWhich == ELEM_COMMENT) break; - int i, j; - if(FindSelected(&i, &j)) { - i--; - while(i >= 0 && (!VALID_LEAF(DisplayMatrix[i][j]) || - (DisplayMatrix[i][j] == Selected))) - { - i--; - } - if(i >= 0) { - SelectElement(i, j, SELECTED_RIGHT); - } - } - break; - } - case VK_RIGHT: { - if(!Selected || Selected->selectedState == SELECTED_NONE) { - break; - } - if(Selected->selectedState != SELECTED_RIGHT) { - SelectElement(-1, -1, SELECTED_RIGHT); - break; - } - if(SelectedWhich == ELEM_COMMENT) break; - int i, j; - if(FindSelected(&i, &j)) { - i++; - while(i < DISPLAY_MATRIX_X_SIZE && - !VALID_LEAF(DisplayMatrix[i][j])) - { - i++; - } - if(i != DISPLAY_MATRIX_X_SIZE) { - SelectElement(i, j, SELECTED_LEFT); - } - } - break; - } - case VK_UP: { - if(!Selected || Selected->selectedState == SELECTED_NONE) { - break; - } - if(Selected->selectedState != SELECTED_ABOVE && - SelectedWhich != ELEM_PLACEHOLDER) - { - SelectElement(-1, -1, SELECTED_ABOVE); - break; - } - int i, j; - if(FindSelected(&i, &j)) { - j--; - while(j >= 0 && !VALID_LEAF(DisplayMatrix[i][j])) - j--; - if(j >= 0) { - SelectElement(i, j, SELECTED_BELOW); - } - } - break; - } - case VK_DOWN: { - if(!Selected || Selected->selectedState == SELECTED_NONE) { - break; - } - if(Selected->selectedState != SELECTED_BELOW && - SelectedWhich != ELEM_PLACEHOLDER) - { - SelectElement(-1, -1, SELECTED_BELOW); - break; - } - int i, j; - if(FindSelected(&i, &j)) { - j++; - while(j < DISPLAY_MATRIX_Y_SIZE && - !VALID_LEAF(DisplayMatrix[i][j])) - { - j++; - } - if(j != DISPLAY_MATRIX_Y_SIZE) { - SelectElement(i, j, SELECTED_ABOVE); - } else if(ScrollYOffsetMax - ScrollYOffset < 3) { - // special case: scroll the end marker into view - ScrollYOffset = ScrollYOffsetMax; - RefreshScrollbars(); - } - } - break; - } - } +// if(!Selected || Selected->selectedState == SELECTED_NONE) { +// MoveCursorTopLeft(); +// return; +// } + +// switch(keyCode) { +// case VK_LEFT: { +// if(!Selected || Selected->selectedState == SELECTED_NONE) { +// break; +// } +// if(Selected->selectedState != SELECTED_LEFT) { +// SelectElement(-1, -1, SELECTED_LEFT); +// break; +// } +// if(SelectedWhich == ELEM_COMMENT) break; +// int i, j; +// if(FindSelected(&i, &j)) { +// i--; +// while(i >= 0 && (!VALID_LEAF(DisplayMatrix[i][j]) || +// (DisplayMatrix[i][j] == Selected))) +// { +// i--; +// } +// if(i >= 0) { +// SelectElement(i, j, SELECTED_RIGHT); +// } +// } +// break; +// } +// case VK_RIGHT: { +// if(!Selected || Selected->selectedState == SELECTED_NONE) { +// break; +// } +// if(Selected->selectedState != SELECTED_RIGHT) { +// SelectElement(-1, -1, SELECTED_RIGHT); +// break; +// } +// if(SelectedWhich == ELEM_COMMENT) break; +// int i, j; +// if(FindSelected(&i, &j)) { +// i++; +// while(i < DISPLAY_MATRIX_X_SIZE && +// !VALID_LEAF(DisplayMatrix[i][j])) +// { +// i++; +// } +// if(i != DISPLAY_MATRIX_X_SIZE) { +// SelectElement(i, j, SELECTED_LEFT); +// } +// } +// break; +// } +// case VK_UP: { +// if(!Selected || Selected->selectedState == SELECTED_NONE) { +// break; +// } +// if(Selected->selectedState != SELECTED_ABOVE && +// SelectedWhich != ELEM_PLACEHOLDER) +// { +// SelectElement(-1, -1, SELECTED_ABOVE); +// break; +// } +// int i, j; +// if(FindSelected(&i, &j)) { +// j--; +// while(j >= 0 && !VALID_LEAF(DisplayMatrix[i][j])) +// j--; +// if(j >= 0) { +// SelectElement(i, j, SELECTED_BELOW); +// } +// } +// break; +// } +// case VK_DOWN: { +// if(!Selected || Selected->selectedState == SELECTED_NONE) { +// break; +// } +// if(Selected->selectedState != SELECTED_BELOW && +// SelectedWhich != ELEM_PLACEHOLDER) +// { +// SelectElement(-1, -1, SELECTED_BELOW); +// break; +// } +// int i, j; +// if(FindSelected(&i, &j)) { +// j++; +// while(j < DISPLAY_MATRIX_Y_SIZE && +// !VALID_LEAF(DisplayMatrix[i][j])) +// { +// j++; +// } +// if(j != DISPLAY_MATRIX_Y_SIZE) { +// SelectElement(i, j, SELECTED_ABOVE); +// } else if(ScrollYOffsetMax - ScrollYOffset < 3) { +// // special case: scroll the end marker into view +// ScrollYOffset = ScrollYOffsetMax; +// RefreshScrollbars(); +// } +// } +// break; +// } +// } } //----------------------------------------------------------------------------- @@ -397,100 +397,100 @@ void MoveCursorKeyboard(int keyCode) //----------------------------------------------------------------------------- void EditSelectedElement(void) { - if(!Selected || Selected->selectedState == SELECTED_NONE) return; - - switch(SelectedWhich) { - case ELEM_COMMENT: - ShowCommentDialog(Selected->d.comment.str); - break; - - case ELEM_CONTACTS: - ShowContactsDialog(&(Selected->d.contacts.negated), - Selected->d.contacts.name); - break; - - case ELEM_COIL: - ShowCoilDialog(&(Selected->d.coil.negated), - &(Selected->d.coil.setOnly), &(Selected->d.coil.resetOnly), - Selected->d.coil.name); - break; - - case ELEM_TON: - case ELEM_TOF: - case ELEM_RTO: - ShowTimerDialog(SelectedWhich, &(Selected->d.timer.delay), - Selected->d.timer.name); - break; - - case ELEM_CTU: - case ELEM_CTD: - case ELEM_CTC: - ShowCounterDialog(SelectedWhich, &(Selected->d.counter.max), - Selected->d.counter.name); - break; - - case ELEM_EQU: - case ELEM_NEQ: - case ELEM_GRT: - case ELEM_GEQ: - case ELEM_LES: - case ELEM_LEQ: - ShowCmpDialog(SelectedWhich, Selected->d.cmp.op1, - Selected->d.cmp.op2); - break; - - case ELEM_ADD: - case ELEM_SUB: - case ELEM_MUL: - case ELEM_DIV: - ShowMathDialog(SelectedWhich, Selected->d.math.dest, - Selected->d.math.op1, Selected->d.math.op2); - break; - - case ELEM_RES: - ShowResetDialog(Selected->d.reset.name); - break; - - case ELEM_MOVE: - ShowMoveDialog(Selected->d.move.dest, Selected->d.move.src); - break; - - case ELEM_SET_PWM: - ShowSetPwmDialog(Selected->d.setPwm.name, - &(Selected->d.setPwm.targetFreq)); - break; - - case ELEM_READ_ADC: - ShowReadAdcDialog(Selected->d.readAdc.name+1); - break; - - case ELEM_UART_RECV: - case ELEM_UART_SEND: - ShowUartDialog(SelectedWhich, Selected->d.uart.name); - break; - - case ELEM_PERSIST: - ShowPersistDialog(Selected->d.persist.var); - break; - - case ELEM_SHIFT_REGISTER: - ShowShiftRegisterDialog(Selected->d.shiftRegister.name, - &(Selected->d.shiftRegister.stages)); - break; - - case ELEM_FORMATTED_STRING: - ShowFormattedStringDialog(Selected->d.fmtdStr.var, - Selected->d.fmtdStr.string); - break; - - case ELEM_PIECEWISE_LINEAR: - ShowPiecewiseLinearDialog(Selected); - break; - - case ELEM_LOOK_UP_TABLE: - ShowLookUpTableDialog(Selected); - break; - } +// if(!Selected || Selected->selectedState == SELECTED_NONE) return; + +// switch(SelectedWhich) { +// case ELEM_COMMENT: +// ShowCommentDialog(Selected->d.comment.str); +// break; + +// case ELEM_CONTACTS: +// ShowContactsDialog(&(Selected->d.contacts.negated), +// Selected->d.contacts.name); +// break; + +// case ELEM_COIL: +// ShowCoilDialog(&(Selected->d.coil.negated), +// &(Selected->d.coil.setOnly), &(Selected->d.coil.resetOnly), +// Selected->d.coil.name); +// break; + +// case ELEM_TON: +// case ELEM_TOF: +// case ELEM_RTO: +// ShowTimerDialog(SelectedWhich, &(Selected->d.timer.delay), +// Selected->d.timer.name); +// break; + +// case ELEM_CTU: +// case ELEM_CTD: +// case ELEM_CTC: +// ShowCounterDialog(SelectedWhich, &(Selected->d.counter.max), +// Selected->d.counter.name); +// break; + +// case ELEM_EQU: +// case ELEM_NEQ: +// case ELEM_GRT: +// case ELEM_GEQ: +// case ELEM_LES: +// case ELEM_LEQ: +// ShowCmpDialog(SelectedWhich, Selected->d.cmp.op1, +// Selected->d.cmp.op2); +// break; + +// case ELEM_ADD: +// case ELEM_SUB: +// case ELEM_MUL: +// case ELEM_DIV: +// ShowMathDialog(SelectedWhich, Selected->d.math.dest, +// Selected->d.math.op1, Selected->d.math.op2); +// break; + +// case ELEM_RES: +// ShowResetDialog(Selected->d.reset.name); +// break; + +// case ELEM_MOVE: +// ShowMoveDialog(Selected->d.move.dest, Selected->d.move.src); +// break; + +// case ELEM_SET_PWM: +// ShowSetPwmDialog(Selected->d.setPwm.name, +// &(Selected->d.setPwm.targetFreq)); +// break; + +// case ELEM_READ_ADC: +// ShowReadAdcDialog(Selected->d.readAdc.name+1); +// break; + +// case ELEM_UART_RECV: +// case ELEM_UART_SEND: +// ShowUartDialog(SelectedWhich, Selected->d.uart.name); +// break; + +// case ELEM_PERSIST: +// ShowPersistDialog(Selected->d.persist.var); +// break; + +// case ELEM_SHIFT_REGISTER: +// ShowShiftRegisterDialog(Selected->d.shiftRegister.name, +// &(Selected->d.shiftRegister.stages)); +// break; + +// case ELEM_FORMATTED_STRING: +// ShowFormattedStringDialog(Selected->d.fmtdStr.var, +// Selected->d.fmtdStr.string); +// break; + +// case ELEM_PIECEWISE_LINEAR: +// ShowPiecewiseLinearDialog(Selected); +// break; + +// case ELEM_LOOK_UP_TABLE: +// ShowLookUpTableDialog(Selected); +// break; +// } } //----------------------------------------------------------------------------- @@ -502,30 +502,30 @@ void EditSelectedElement(void) //----------------------------------------------------------------------------- void EditElementMouseDoubleclick(int x, int y) { - x += ScrollXOffset; - - y += FONT_HEIGHT/2; - - int gx = (x - X_PADDING)/(POS_WIDTH*FONT_WIDTH); - int gy = (y - Y_PADDING)/(POS_HEIGHT*FONT_HEIGHT); - - gy += ScrollYOffset; - - if(InSimulationMode) { - ElemLeaf *l = DisplayMatrix[gx][gy]; - if(l && DisplayMatrixWhich[gx][gy] == ELEM_CONTACTS) { - char *name = l->d.contacts.name; - if(name[0] == 'X') { - SimulationToggleContact(name); - } - } else if(l && DisplayMatrixWhich[gx][gy] == ELEM_READ_ADC) { - ShowAnalogSliderPopup(l->d.readAdc.name); - } - } else { - if(DisplayMatrix[gx][gy] == Selected) { - EditSelectedElement(); - } - } +// x += ScrollXOffset; + +// y += FONT_HEIGHT/2; + +// int gx = (x - X_PADDING)/(POS_WIDTH*FONT_WIDTH); +// int gy = (y - Y_PADDING)/(POS_HEIGHT*FONT_HEIGHT); + +// gy += ScrollYOffset; + +// if(InSimulationMode) { +// ElemLeaf *l = DisplayMatrix[gx][gy]; +// if(l && DisplayMatrixWhich[gx][gy] == ELEM_CONTACTS) { +// char *name = l->d.contacts.name; +// if(name[0] == 'X') { +// SimulationToggleContact(name); +// } +// } else if(l && DisplayMatrixWhich[gx][gy] == ELEM_READ_ADC) { +// ShowAnalogSliderPopup(l->d.readAdc.name); +// } +// } else { +// if(DisplayMatrix[gx][gy] == Selected) { +// EditSelectedElement(); +// } +// } } //----------------------------------------------------------------------------- @@ -536,71 +536,71 @@ void EditElementMouseDoubleclick(int x, int y) //----------------------------------------------------------------------------- void MoveCursorMouseClick(int x, int y) { - x += ScrollXOffset; - - y += FONT_HEIGHT/2; - - int gx0 = (x - X_PADDING)/(POS_WIDTH*FONT_WIDTH); - int gy0 = (y - Y_PADDING)/(POS_HEIGHT*FONT_HEIGHT); - - int gx = gx0; - int gy = gy0 + ScrollYOffset; - - if(VALID_LEAF(DisplayMatrix[gx][gy])) { - int i, j; - for(i = 0; i < DISPLAY_MATRIX_X_SIZE; i++) { - for(j = 0; j < DISPLAY_MATRIX_Y_SIZE; j++) { - if(DisplayMatrix[i][j]) - DisplayMatrix[i][j]->selectedState = SELECTED_NONE; - } - } - int dx = x - (gx0*POS_WIDTH*FONT_WIDTH + X_PADDING); - int dy = y - (gy0*POS_HEIGHT*FONT_HEIGHT + Y_PADDING); - - int dtop = dy; - int dbottom = POS_HEIGHT*FONT_HEIGHT - dy; - int dleft = dx; - int dright = POS_WIDTH*FONT_WIDTH - dx; - - int extra = 1; - if(DisplayMatrixWhich[gx][gy] == ELEM_COMMENT) { - dleft += gx*POS_WIDTH*FONT_WIDTH; - dright += (ColsAvailable - gx - 1)*POS_WIDTH*FONT_WIDTH; - extra = ColsAvailable; - } else { - if((gx > 0) && (DisplayMatrix[gx-1][gy] == DisplayMatrix[gx][gy])) { - dleft += POS_WIDTH*FONT_WIDTH; - extra = 2; - } - if((gx < (DISPLAY_MATRIX_X_SIZE-1)) && - (DisplayMatrix[gx+1][gy] == DisplayMatrix[gx][gy])) - { - dright += POS_WIDTH*FONT_WIDTH; - extra = 2; - } - } - - int decideX = (dright - dleft); - int decideY = (dtop - dbottom); - - decideY = decideY*3*extra; - - int state; - if(abs(decideY) > abs(decideX)) { - if(decideY > 0) { - state = SELECTED_BELOW; - } else { - state = SELECTED_ABOVE; - } - } else { - if(decideX > 0) { - state = SELECTED_LEFT; - } else { - state = SELECTED_RIGHT; - } - } - SelectElement(gx, gy, state); - } +// x += ScrollXOffset; + +// y += FONT_HEIGHT/2; + +// int gx0 = (x - X_PADDING)/(POS_WIDTH*FONT_WIDTH); +// int gy0 = (y - Y_PADDING)/(POS_HEIGHT*FONT_HEIGHT); + +// int gx = gx0; +// int gy = gy0 + ScrollYOffset; + +// if(VALID_LEAF(DisplayMatrix[gx][gy])) { +// int i, j; +// for(i = 0; i < DISPLAY_MATRIX_X_SIZE; i++) { +// for(j = 0; j < DISPLAY_MATRIX_Y_SIZE; j++) { +// if(DisplayMatrix[i][j]) +// DisplayMatrix[i][j]->selectedState = SELECTED_NONE; +// } +// } +// int dx = x - (gx0*POS_WIDTH*FONT_WIDTH + X_PADDING); +// int dy = y - (gy0*POS_HEIGHT*FONT_HEIGHT + Y_PADDING); + +// int dtop = dy; +// int dbottom = POS_HEIGHT*FONT_HEIGHT - dy; +// int dleft = dx; +// int dright = POS_WIDTH*FONT_WIDTH - dx; + +// int extra = 1; +// if(DisplayMatrixWhich[gx][gy] == ELEM_COMMENT) { +// dleft += gx*POS_WIDTH*FONT_WIDTH; +// dright += (ColsAvailable - gx - 1)*POS_WIDTH*FONT_WIDTH; +// extra = ColsAvailable; +// } else { +// if((gx > 0) && (DisplayMatrix[gx-1][gy] == DisplayMatrix[gx][gy])) { +// dleft += POS_WIDTH*FONT_WIDTH; +// extra = 2; +// } +// if((gx < (DISPLAY_MATRIX_X_SIZE-1)) && +// (DisplayMatrix[gx+1][gy] == DisplayMatrix[gx][gy])) +// { +// dright += POS_WIDTH*FONT_WIDTH; +// extra = 2; +// } +// } + +// int decideX = (dright - dleft); +// int decideY = (dtop - dbottom); + +// decideY = decideY*3*extra; + +// int state; +// if(abs(decideY) > abs(decideX)) { +// if(decideY > 0) { +// state = SELECTED_BELOW; +// } else { +// state = SELECTED_ABOVE; +// } +// } else { +// if(decideX > 0) { +// state = SELECTED_LEFT; +// } else { +// state = SELECTED_RIGHT; +// } +// } +// SelectElement(gx, gy, state); +// } } //----------------------------------------------------------------------------- @@ -609,49 +609,49 @@ void MoveCursorMouseClick(int x, int y) //----------------------------------------------------------------------------- void MoveCursorNear(int gx, int gy) { - int out = 0; - - for(out = 0; out < 8; out++) { - if(gx - out >= 0) { - if(VALID_LEAF(DisplayMatrix[gx-out][gy])) { - SelectElement(gx-out, gy, SELECTED_RIGHT); - return; - } - } - if(gx + out < DISPLAY_MATRIX_X_SIZE) { - if(VALID_LEAF(DisplayMatrix[gx+out][gy])) { - SelectElement(gx+out, gy, SELECTED_LEFT); - return; - } - } - if(gy - out >= 0) { - if(VALID_LEAF(DisplayMatrix[gx][gy-out])) { - SelectElement(gx, gy-out, SELECTED_BELOW); - return; - } - } - if(gy + out < DISPLAY_MATRIX_Y_SIZE) { - if(VALID_LEAF(DisplayMatrix[gx][gy+out])) { - SelectElement(gx, gy+out, SELECTED_ABOVE); - return; - } - } - - if(out == 1) { - // Now see if we have a straight shot to the right; might be far - // if we have to go up to a coil or other end of line element. - int across; - for(across = 1; gx+across < DISPLAY_MATRIX_X_SIZE; across++) { - if(VALID_LEAF(DisplayMatrix[gx+across][gy])) { - SelectElement(gx+across, gy, SELECTED_LEFT); - return; - } - if(!DisplayMatrix[gx+across][gy]) break; - } - } - } - - MoveCursorTopLeft(); +// int out = 0; + +// for(out = 0; out < 8; out++) { +// if(gx - out >= 0) { +// if(VALID_LEAF(DisplayMatrix[gx-out][gy])) { +// SelectElement(gx-out, gy, SELECTED_RIGHT); +// return; +// } +// } +// if(gx + out < DISPLAY_MATRIX_X_SIZE) { +// if(VALID_LEAF(DisplayMatrix[gx+out][gy])) { +// SelectElement(gx+out, gy, SELECTED_LEFT); +// return; +// } +// } +// if(gy - out >= 0) { +// if(VALID_LEAF(DisplayMatrix[gx][gy-out])) { +// SelectElement(gx, gy-out, SELECTED_BELOW); +// return; +// } +// } +// if(gy + out < DISPLAY_MATRIX_Y_SIZE) { +// if(VALID_LEAF(DisplayMatrix[gx][gy+out])) { +// SelectElement(gx, gy+out, SELECTED_ABOVE); +// return; +// } +// } + +// if(out == 1) { +// // Now see if we have a straight shot to the right; might be far +// // if we have to go up to a coil or other end of line element. +// int across; +// for(across = 1; gx+across < DISPLAY_MATRIX_X_SIZE; across++) { +// if(VALID_LEAF(DisplayMatrix[gx+across][gy])) { +// SelectElement(gx+across, gy, SELECTED_LEFT); +// return; +// } +// if(!DisplayMatrix[gx+across][gy]) break; +// } +// } +// } + +// MoveCursorTopLeft(); } //----------------------------------------------------------------------------- diff --git a/ldmicro/simpledialog.cpp b/ldmicro/simpledialog.cpp index 3e88adc..7edfc5c 100644 --- a/ldmicro/simpledialog.cpp +++ b/ldmicro/simpledialog.cpp @@ -22,8 +22,8 @@ // operands. Try to reuse code a bit. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> -#include <commctrl.h> +#include "linuxUI.h" +//#include <commctrl.h> #include <stdio.h> #include <stdlib.h> diff --git a/ldmicro/simulate.cpp b/ldmicro/simulate.cpp index 7e2f204..57da046 100644 --- a/ldmicro/simulate.cpp +++ b/ldmicro/simulate.cpp @@ -24,8 +24,8 @@ // timers, etc. // Jonathan Westhues, Nov 2004 //----------------------------------------------------------------------------- -#include <windows.h> -#include <commctrl.h> +#include "linuxUI.h" +//#include <commctrl.h> #include <stdio.h> #include <stdlib.h> #include <limits.h> diff --git a/ldmicro/undoredo.cpp b/ldmicro/undoredo.cpp index 43e6693..69831d8 100644 --- a/ldmicro/undoredo.cpp +++ b/ldmicro/undoredo.cpp @@ -22,7 +22,7 @@ // the entire program at all times. // Jonathan Westhues, split May 2005 //----------------------------------------------------------------------------- -#include <windows.h> +#include "linuxUI.h" #include <stdio.h> #include <stdlib.h> @@ -198,9 +198,9 @@ void UndoUndo(void) } else { SetUndoEnabled(FALSE, TRUE); } - RefreshControlsToSettings(); - RefreshScrollbars(); - InvalidateRect(MainWindow, NULL, FALSE); + // RefreshControlsToSettings(); + // RefreshScrollbars(); + // InvalidateRect(MainWindow, NULL, FALSE); } //----------------------------------------------------------------------------- @@ -221,9 +221,9 @@ void UndoRedo(void) } else { SetUndoEnabled(TRUE, FALSE); } - RefreshControlsToSettings(); - RefreshScrollbars(); - InvalidateRect(MainWindow, NULL, FALSE); + //RefreshControlsToSettings(); + //RefreshScrollbars(); + //InvalidateRect(MainWindow, NULL, FALSE); } //----------------------------------------------------------------------------- diff --git a/test/7seg-display.ld b/test/7seg-display.ld new file mode 100644 index 0000000..b9d0c9d --- /dev/null +++ b/test/7seg-display.ld @@ -0,0 +1,123 @@ +LDmicro0.1 +CYCLE=5000 +CRYSTAL=4000000 +BAUD=2400 + +IO LIST + Ycom_digit0 at 0 + Ycom_digit1 at 0 + Ycom_digit2 at 0 + Yseg_a at 0 + Yseg_b at 0 + Yseg_c at 0 + Yseg_d at 0 + Yseg_e at 0 + Yseg_f at 0 + Yseg_g at 0 +END + +PROGRAM +RUNG + COMMENT Sample program: how to drive a multiplexed 7-segment LED display. This is\r\nfor a 3-digit common-cathode display but it is easy to modify. +END +RUNG + COMMENT With a 5 ms cycle time, this will oscillate at 100 Hz, which should be\r\nokay (33 Hz refresh rate, 1/3 duty cycle). +END +RUNG + CONTACTS Rdosc 1 + COIL Rdosc 0 0 0 +END +RUNG + CONTACTS Rdosc 0 + CTC Cdigit 2 +END +RUNG + COMMENT Use the Ycom_digitx lines to drive the base/gate of the NPN transistor/\r\nn-FET used to switch the cathode of digit x. +END +RUNG + PARALLEL + SERIES + EQU Cdigit 0 + PARALLEL + COIL Ycom_digit0 0 0 0 + MOVE digit digit0 + END + END + SERIES + EQU Cdigit 1 + PARALLEL + COIL Ycom_digit1 0 0 0 + MOVE digit digit1 + END + END + SERIES + EQU Cdigit 2 + PARALLEL + COIL Ycom_digit2 0 0 0 + MOVE digit digit2 + END + END + END +END +RUNG + COMMENT You can drive the segment pins of the display directly from the GPIO pins,\r\nYseg_a to Yseg_b. +END +RUNG + PARALLEL + SERIES + NEQ digit 1 + NEQ digit 4 + COIL Yseg_a 0 0 0 + END + SERIES + NEQ digit 5 + NEQ digit 6 + COIL Yseg_b 0 0 0 + END + SERIES + NEQ digit 2 + COIL Yseg_c 0 0 0 + END + SERIES + NEQ digit 1 + NEQ digit 4 + NEQ digit 7 + COIL Yseg_d 0 0 0 + END + SERIES + PARALLEL + EQU digit 0 + EQU digit 2 + EQU digit 6 + EQU digit 8 + END + COIL Yseg_e 0 0 0 + END + SERIES + NEQ digit 1 + NEQ digit 2 + NEQ digit 3 + NEQ digit 7 + COIL Yseg_f 0 0 0 + END + SERIES + NEQ digit 0 + NEQ digit 1 + NEQ digit 7 + COIL Yseg_g 0 0 0 + END + END +END +RUNG + COMMENT Fill in your program here; just set the output that you want on digit0,\r\ndigit1, and digit2. +END +RUNG + PARALLEL + MOVE digit0 1 + MOVE digit1 8 + MOVE digit2 5 + END +END +RUNG + COMMENT by Jonathan Westhues, June 2005 +END diff --git a/test/LDMicro b/test/LDMicro Binary files differnew file mode 100755 index 0000000..59a91f5 --- /dev/null +++ b/test/LDMicro diff --git a/test/blink.ld b/test/blink.ld new file mode 100644 index 0000000..e86d7a3 --- /dev/null +++ b/test/blink.ld @@ -0,0 +1,61 @@ +LDmicro0.1 +MICRO=Microchip PIC16F877 40-PDIP +CYCLE=10000 +CRYSTAL=4000000 +COMPILED=C:\depot\ldmicro\pic.hex + +IO LIST + Xbutton at 21 + Yled at 30 +END + +PROGRAM +RUNG + CONTACTS Xbutton 1 + CTC Cwhich 4 +END +RUNG + CONTACTS Xbutton 1 + OSF + TOF Tdblclk 500000 + COIL Rdblclk 0 0 0 +END +RUNG + CONTACTS Xbutton 1 + CONTACTS Rdblclk 0 + MOVE Cwhich 3 +END +RUNG + CONTACTS Rfast 0 + TOF Tffast 100000 + TON Tnfast 100000 + COIL Rfast 1 0 0 +END +RUNG + CONTACTS Rslow 0 + TON Tnslow 100000 + TOF Tfslow 1000000 + COIL Rslow 1 0 0 +END +RUNG + PARALLEL + SERIES + EQU Cwhich 0 + CONTACTS Rfast 0 + END + SERIES + EQU Cwhich 1 + CONTACTS Rslow 0 + END + SERIES + EQU Cwhich 2 + CONTACTS Rslow 1 + END + EQU Cwhich 3 + SERIES + EQU Cwhich 4 + OPEN + END + END + COIL Yled 0 0 0 +END diff --git a/test/ldTest/expected/avr-hw.hex b/test/ldTest/expected/avr-hw.hex new file mode 100644 index 0000000..1fdd509 --- /dev/null +++ b/test/ldTest/expected/avr-hw.hex @@ -0,0 +1,330 @@ +:1000000022C0189518951895189518951895189553 +:100010001895189518951895189518951895189578 +:100020001895189518951895189518951895189568 +:100030001895189518951895189518951895189558 +:10004000189518951895B0E0AEE500E10C93B0E076 +:10005000ADE50FEF0C93B1E1A0E000E020E030E16E +:10006000A150B0400C93215030402223C9F73323D4 +:10007000B9F7B0E0A8E900E00C93B0E0A9E907E621 +:100080000C93B0E0AAE908E10C93B0E0AAE300E029 +:100090000C93B0E0ABE300E00C93B0E0A7E300E822 +:1000A0000C93B0E0A8E300E00C93B0E0A4E300E020 +:1000B0000C93B0E0A5E300E00C93B0E0A1E308E00E +:1000C0000C93B0E0A2E300E00C93B0E0A2E200E009 +:1000D0000C93B0E0A3E201E00C93B0E0A1E600E0F5 +:1000E0000C93B0E0A2E600E00C93B0E0A4E600E0E0 +:1000F0000C93B0E0A5E600E00C93B0E0AFE400E0C4 +:100100000C93B0E0AEE409E00C93B0E0ABE40CE992 +:100110000C93B0E0AAE40EE30C93B0E0A7E500E195 +:100120000C93B0E0A6E50C9104FFFBCFB0E0A6E590 +:100130000C9100610C93A895B1E0A1E00C910260D4 +:100140000C93B1E0A1E00C91B1E0A1E01C9101FFA2 +:100150001B7F01FD14601C93B1E0A1E00C9102FF34 +:10016000EFC0B1E0A1E00C9103FD60C0B1E0A1E0FF +:100170000C910F7E0C93B0E0ACE30C9101FD23C019 +:10018000B1E0A1E00C9100FF23C0B0E0AEE30C9120 +:10019000B0E0AFE31C91039509F413951C93B0E014 +:1001A000AEE30C93B1E0A0E00C91B0E0ADE30C93B2 +:1001B000B0E0ACE304E00C9306E00C93B1E0A1E006 +:1001C0000C910E7F0C93B1E0A1E00C9100610C93B7 +:1001D000B1E0A1E00C9104FD29C0B1E0A1E00C91D7 +:1001E00008600C93B0E0AFE300E00C93B0E0AEE346 +:1001F00000E00C93B0E0ACE301E00C93B0E0ADE3C1 +:100200000C91B1E0A2E00C93B0E0AFE300E00C93FE +:10021000B0E0AEE301E00C93B0E0ACE301E00C939E +:10022000B0E0ADE30C91B1E0A3E00C93B1E0A1E04C +:100230000C910F7E0C93B0E0ACE30C9101FD23C058 +:10024000B1E0A1E00C9100FF23C0B0E0AEE30C915F +:10025000B0E0AFE31C91039509F413951C93B0E053 +:10026000AEE30C93B1E0A0E00C91B0E0ADE30C93F1 +:10027000B0E0ACE304E00C9306E00C93B1E0A1E045 +:100280000C910E7F0C93B1E0A1E00C9100610C93F6 +:10029000B1E0A1E00C9104FD53C0B0E0AFE300E099 +:1002A0000C93B0E0AEE300E00C93B0E0ACE301E00F +:1002B0000C93B0E0ADE30C91B1E0A4E00C93B0E09E +:1002C000AFE300E00C93B0E0AEE301E00C93B0E0EC +:1002D000ACE301E00C93B0E0ADE30C91B1E0A5E03C +:1002E0000C93B1E0A4E00C91B1E0A5E01C91B1E069 +:1002F000A2E02C91B1E0A3E03C910217130709F4AE +:100300001FC0B1E0A1E00C9101600C93B1E0A3E04B +:100310000C91B1E0A0E00C93B0E0AFE300E00C93EF +:10032000B0E0AEE300E00C93B1E0A2E00C91B0E0ED +:10033000ADE30C93B0E0ACE304E00C9306E00C9367 +:10034000B1E0A1E00C91B1E0A1E01C9101FF1B7FA5 +:1003500001FD14601C93B1E0A1E00C9102FF1DC0EF +:10036000B0E0A7E200E00C93B0E0A6E205E80C9351 +:10037000B0E0A6E205EC0C93B0E0A6E20C9106FD1D +:10038000FBCFB0E0A4E20C91B1E0A6E00C93B0E0AA +:10039000A5E20C91B1E0A7E00C93B1E0A1E00C91D3 +:1003A000B1E0A1E01C9101FF1B7F01FD14601C93D3 +:1003B000B1E0A1E00C910F7D0C93B1E0A1E00C91B4 +:1003C000B1E0A1E01C9102FF1F7B02FD10641C93B1 +:1003D000B0E0A1E20C9100FD05C0B1E0A1E00C91FC +:1003E0000F7B0C93B1E0A1E00C9106FF05C0B1E0DA +:1003F000A1E00C9100620C93B1E0A1E00C91B1E09E +:10040000A1E01C9102FF1F7B02FD10641C93B1E070 +:10041000A8E000E00C93B1E0A9E002E00C93B1E0A9 +:10042000A8E00C91B1E0A9E01C91B1E0A6E02C910C +:10043000B1E0A7E03C91201731072CF4B1E0A1E036 +:100440000C910F7B0C93B1E0A1E00C9106FF05C06D +:10045000B1E0A1E00C9100620C93B1E0A1E00C913D +:10046000B1E0A1E01C9105FF1B7F05FD14601C930A +:10047000B1E0A1E00C91B1E0A1E01C9102FF1F7E70 +:1004800002FD10611C93B1E0A1E00C9107FF05C0D3 +:10049000B1E0A1E00C910B7F0C93B1E0A1E00C91D5 +:1004A000B1E0A1E01C9104FF1F7704FD10681C93CC +:1004B000B1E0A1E00C9102FF1CC0B1E0A8E001E0B6 +:1004C0000C93B1E0A9E000E00C93B1E0A2E02C9124 +:1004D000B1E0A3E03C91B1E0A8E00C91B1E0A9E06B +:1004E0001C91200F311FB1E0A2E02C93B1E0A3E0FA +:1004F0003C93B1E0A1E00C91B1E0A1E01C9101FFBF +:100500001B7F01FD14601C93B1E0AAE00C910E7FEB +:100510000C93B1E0A1E00C91B1E0AAE01C9102FFC4 +:100520001D7F02FD12601C93B1E0A8E00AE00C936D +:10053000B1E0A9E000E00C93B1E0A8E00C91B1E0DB +:10054000A9E01C91B1E0A2E02C91B1E0A3E03C91C4 +:10055000201731070CF405C0B1E0AAE00C910D7F23 +:100560000C93B1E0AAE00C9101FF08C0B1E0ABE050 +:1005700004E10C93B1E0ACE000E00C93B1E0AAE040 +:100580000C9101FF05C0B1E0AAE00C9101600C9351 +:10059000B1E0A1E00C91B1E0AAE01C9102FF1D7F47 +:1005A00002FD12601C93B1E0A8E00AE00C93B1E0F8 +:1005B000A9E000E00C93B1E0A8E00C91B1E0A9E063 +:1005C0001C91B1E0A2E02C91B1E0A3E03C91201796 +:1005D00031072CF4B1E0AAE00C910D7F0C93B1E04F +:1005E000AAE00C9101FF08C0B1E0ABE002E30C937C +:1005F000B1E0ACE000E00C93B1E0AAE00C9101FFA7 +:1006000005C0B1E0AAE00C9101600C93B1E0A1E05B +:100610000C91B1E0AAE01C9102FF1D7F02FD126067 +:100620001C93B1E0AAE00C9101FF21C0B1E0ABE066 +:100630000C9110E030E02FEFEAE0FAE00995132F7B +:10064000022F30E024E6EBE1FAE00995B0E0A3E404 +:100650000C93B1E0AAE00C9102FD09C0B1E0AAE060 +:100660000C9104600C93B0E0A5E40AE60C93B1E0B1 +:10067000AAE00C9101FF05C0B1E0AAE00C91016075 +:100680000C93B1E0AAE00C91B1E0A1E01C9100FF55 +:100690001B7F00FD14601C93B1E0A1E00C91B1E060 +:1006A000A1E01C9101FF1B7F01FD14601C93B1E0D0 +:1006B000A1E00C9102FF1EC0B1E0ADE00C91B1E0F1 +:1006C000AEE01C9123E630E00217130794F4B1E08A +:1006D000ADE00C91B1E0AEE01C91039509F41395E7 +:1006E0001C93B1E0ADE00C93B1E0A1E00C910B7F65 +:1006F0000C9308C0B1E0ADE000E00C93B1E0AEE0D7 +:1007000000E00C93B1E0A1E00C91B1E0A1E01C91FC +:1007100002FF1F7E02FD10611C93B1E0AAE00C9164 +:1007200003FF05C0B1E0A1E00C910B7F0C93B1E099 +:10073000A1E00C91B1E0AAE01C9104FF177F04FD39 +:1007400018601C93B1E0A1E00C9102FF0DC0B1E074 +:10075000AAE00C9104FD08C0B1E0AFE000E00C930A +:10076000B1E0A0E100E00C93B1E0A1E00C91B1E0B8 +:10077000AAE01C9102FF1F7E02FD10611C93B1E0F4 +:10078000AFE00C91B1E0A1E10C93B1E0A0E10C91DC +:10079000B1E0A2E10C93B1E0AFE00C91B1E0A0E1D7 +:1007A0001C9120E130E0021713070CF408C0B1E0FF +:1007B000A1E10FEF0C93B1E0A2E10FEF0C93B1E0D8 +:1007C000A1E00C910F7E0C93B1E0A1E00C9104FF2D +:1007D00006C0B1E0A4E00C91B0E0ACE90C93B1E04C +:1007E000A1E00C910F7E0C93B0E0ABE90C9105FDFC +:1007F00005C0B1E0A1E00C9100610C93B1E0A1E073 +:100800000C9104FF08C0B1E0A1E10FEF0C93B1E03F +:10081000A2E10FEF0C93B1E0A4E000E00C93B1E093 +:10082000A5E000E00C93B1E0A4E00C91B1E0A5E0FC +:100830001C91B1E0A1E12C91B1E0A2E13C91021741 +:10084000130741F4B1E0A8E003E70C93B1E0A9E09D +:1008500000E00C93B1E0A4E001E00C93B1E0A5E06E +:1008600000E00C93B1E0A4E00C91B1E0A5E01C9194 +:10087000B1E0A1E12C91B1E0A2E13C910217130794 +:1008800041F4B1E0A8E001E60C93B1E0A9E000E09A +:100890000C93B1E0A4E002E00C93B1E0A5E000E02D +:1008A0000C93B1E0A4E00C91B1E0A5E01C91B1E0A3 +:1008B000A1E12C91B1E0A2E13C910217130741F4B0 +:1008C000B1E0A8E006E70C93B1E0A9E000E00C93EA +:1008D000B1E0A4E003E00C93B1E0A5E000E00C93EC +:1008E000B1E0A4E00C91B1E0A5E01C91B1E0A1E180 +:1008F0002C91B1E0A2E13C910217130741F4B1E061 +:10090000A8E005E60C93B1E0A9E000E00C93B1E0AB +:10091000A4E004E00C93B1E0A5E000E00C93B1E0AA +:10092000A4E00C91B1E0A5E01C91B1E0A1E12C9113 +:10093000B1E0A2E13C910217130741F4B1E0A8E055 +:1009400004E60C93B1E0A9E000E00C93B1E0A4E070 +:1009500005E00C93B1E0A5E000E00C93B1E0A4E069 +:100960000C91B1E0A5E01C91B1E0A1E12C91B1E0C6 +:10097000A2E13C910217130741F4B1E0A8E000E2C4 +:100980000C93B1E0A9E000E00C93B1E0A4E006E034 +:100990000C93B1E0A5E000E00C93B1E0A4E00C9171 +:1009A000B1E0A5E01C91B1E0A1E12C91B1E0A2E1A0 +:1009B0003C910217130741F4B1E0A8E00DE30C935A +:1009C000B1E0A9E000E00C93B1E0A4E007E00C93F3 +:1009D000B1E0A5E000E00C93B1E0A4E00C91B1E03F +:1009E000A5E01C91B1E0A1E12C91B1E0A2E13C9124 +:1009F0000217130741F4B1E0A8E000E20C93B1E064 +:100A0000A9E000E00C93B1E0A4E008E00C93B1E0B1 +:100A1000A5E000E00C93B1E0A1E00C910F7E0C93F7 +:100A2000B1E0A4E00C91B1E0A5E01C91B1E0A1E13E +:100A30002C91B1E0A2E13C910217130729F4B1E037 +:100A4000A1E00C9100610C93B1E0A1E00C9104FFD6 +:100A500043C0B1E0A2E00C91B1E0A3E10C93B1E09E +:100A6000A3E00C91B1E0A4E10C93B1E0A8E000E2B6 +:100A70000C93B1E0A9E000E00C93B1E0A2E00C918E +:100A8000B1E0A3E01C9120E030E00217130724F549 +:100A9000B1E0A8E00DE20C93B1E0A9E000E00C9316 +:100AA000B1E0A4E000E00C93B1E0A5E000E00C931D +:100AB000B1E0A4E02C91B1E0A5E03C91B1E0A2E06E +:100AC0000C91B1E0A3E01C91201B310BB1E0A3E13C +:100AD0002C93B1E0A4E13C93B1E0A4E009E00C93D5 +:100AE000B1E0A5E000E00C93B1E0A1E00C910F7E35 +:100AF0000C93B1E0A4E00C91B1E0A5E01C91B1E051 +:100B0000A1E12C91B1E0A2E13C910217130729F475 +:100B1000B1E0A1E00C9100610C93B1E0A1E00C9177 +:100B200004FF89C0B1E0AAE00C9100620C93B1E02F +:100B3000A4E000E10C93B1E0A5E007E20C93B1E082 +:100B4000A4E02C91B1E0A5E03C91B1E0A3E10C91CF +:100B5000B1E0A4E11C91EBE1FAE00995B1E0A8E075 +:100B60000C93B1E0A9E01C93B1E0A4E02C91B1E0BA +:100B7000A5E03C91B1E0A8E00C91B1E0A9E01C91A6 +:100B8000EAE0FAE00995B1E0A4E02C93B1E0A5E039 +:100B90003C93B1E0A3E12C91B1E0A4E13C91B1E040 +:100BA000A4E00C91B1E0A5E01C91201B310BB1E059 +:100BB000A3E12C93B1E0A4E13C93B1E0A4E000E315 +:100BC0000C93B1E0A5E000E00C93B1E0A8E02C911B +:100BD000B1E0A9E03C91B1E0A4E00C91B1E0A5E066 +:100BE0001C91200F311FB1E0A8E02C93B1E0A9E0E7 +:100BF0003C93B1E0A4E00C91B1E0A5E01C91B1E020 +:100C0000A8E02C91B1E0A9E03C910217130771F420 +:100C1000B1E0AAE00C9105FF08C0B1E0A8E000E255 +:100C20000C93B1E0A9E000E00C9305C0B1E0AAE0AC +:100C30000C910F7D0C93B1E0A4E00AE00C93B1E0BD +:100C4000A5E000E00C93B1E0A1E00C910F7E0C93C5 +:100C5000B1E0A4E00C91B1E0A5E01C91B1E0A1E10C +:100C60002C91B1E0A2E13C910217130729F4B1E005 +:100C7000A1E00C9100610C93B1E0A1E00C9104FFA4 +:100C800084C0B1E0A4E008EE0C93B1E0A5E003E07D +:100C90000C93B1E0A4E02C91B1E0A5E03C91B1E06F +:100CA000A3E10C91B1E0A4E11C91EBE1FAE009951C +:100CB000B1E0A8E00C93B1E0A9E01C93B1E0A4E09E +:100CC0002C91B1E0A5E03C91B1E0A8E00C91B1E03D +:100CD000A9E01C91EAE0FAE00995B1E0A4E02C93C8 +:100CE000B1E0A5E03C93B1E0A3E12C91B1E0A4E137 +:100CF0003C91B1E0A4E00C91B1E0A5E01C91201B77 +:100D0000310BB1E0A3E12C93B1E0A4E13C93B1E05D +:100D1000A4E000E30C93B1E0A5E000E00C93B1E0A7 +:100D2000A8E02C91B1E0A9E03C91B1E0A4E00C91E5 +:100D3000B1E0A5E01C91200F311FB1E0A8E02C9399 +:100D4000B1E0A9E03C93B1E0A4E00C91B1E0A5E0F2 +:100D50001C91B1E0A8E02C91B1E0A9E03C91021710 +:100D6000130771F4B1E0AAE00C9105FF08C0B1E0EF +:100D7000A8E000E20C93B1E0A9E000E00C9305C00C +:100D8000B1E0AAE00C910F7D0C93B1E0A4E00BE080 +:100D90000C93B1E0A5E000E00C93B1E0A1E00C9170 +:100DA0000F7E0C93B1E0A4E00C91B1E0A5E01C91A2 +:100DB000B1E0A1E12C91B1E0A2E13C91021713074F +:100DC00029F4B1E0A1E00C9100610C93B1E0A1E045 +:100DD0000C9104FF84C0B1E0A4E004E60C93B1E000 +:100DE000A5E000E00C93B1E0A4E02C91B1E0A5E017 +:100DF0003C91B1E0A3E10C91B1E0A4E11C91EBE1E5 +:100E0000FAE00995B1E0A8E00C93B1E0A9E01C93E9 +:100E1000B1E0A4E02C91B1E0A5E03C91B1E0A8E004 +:100E20000C91B1E0A9E01C91EAE0FAE00995B1E08B +:100E3000A4E02C93B1E0A5E03C93B1E0A3E12C91B8 +:100E4000B1E0A4E13C91B1E0A4E00C91B1E0A5E0F7 +:100E50001C91201B310BB1E0A3E12C93B1E0A4E184 +:100E60003C93B1E0A4E000E30C93B1E0A5E000E026 +:100E70000C93B1E0A8E02C91B1E0A9E03C91B1E085 +:100E8000A4E00C91B1E0A5E01C91200F311FB1E06E +:100E9000A8E02C93B1E0A9E03C93B1E0A4E00C9170 +:100EA000B1E0A5E01C91B1E0A8E02C91B1E0A9E08F +:100EB0003C910217130771F4B1E0AAE00C9105FF11 +:100EC00008C0B1E0A8E000E20C93B1E0A9E000E0C6 +:100ED0000C9305C0B1E0AAE00C910F7D0C93B1E03A +:100EE000A4E00CE00C93B1E0A5E000E00C93B1E0CD +:100EF000A1E00C910F7E0C93B1E0A4E00C91B1E065 +:100F0000A5E01C91B1E0A1E12C91B1E0A2E13C91FE +:100F10000217130729F4B1E0A1E00C9100610C93D2 +:100F2000B1E0A1E00C9104FF84C0B1E0A4E00AE0CC +:100F30000C93B1E0A5E000E00C93B1E0A4E02C91AB +:100F4000B1E0A5E03C91B1E0A3E10C91B1E0A4E1F6 +:100F50001C91EBE1FAE00995B1E0A8E00C93B1E057 +:100F6000A9E01C93B1E0A4E02C91B1E0A5E03C9194 +:100F7000B1E0A8E00C91B1E0A9E01C91EAE0FAE050 +:100F80000995B1E0A4E02C93B1E0A5E03C93B1E079 +:100F9000A3E12C91B1E0A4E13C91B1E0A4E00C917B +:100FA000B1E0A5E01C91201B310BB1E0A3E12C9333 +:100FB000B1E0A4E13C93B1E0A4E000E30C93B1E024 +:100FC000A5E000E00C93B1E0A8E02C91B1E0A9E02D +:100FD0003C91B1E0A4E00C91B1E0A5E01C91200FA0 +:100FE000311FB1E0A8E02C93B1E0A9E03C93B1E05F +:100FF000A4E00C91B1E0A5E01C91B1E0A8E02C9137 +:10100000B1E0A9E03C910217130771F4B1E0AAE046 +:101010000C9105FF08C0B1E0A8E000E20C93B1E03C +:10102000A9E000E00C9305C0B1E0AAE00C910F7DAF +:101030000C93B1E0A4E00DE00C93B1E0A5E000E07A +:101040000C93B1E0A1E00C910F7E0C93B1E0A4E011 +:101050000C91B1E0A5E01C91B1E0A1E12C91B1E0CF +:10106000A2E13C910217130729F4B1E0A1E00C9131 +:1010700000610C93B1E0A1E00C9104FF62C0B1E00B +:10108000A4E001E00C93B1E0A5E000E00C93B1E036 +:10109000A4E02C91B1E0A5E03C91B1E0A3E10C917A +:1010A000B1E0A4E11C91EBE1FAE00995B1E0A8E020 +:1010B0000C93B1E0A9E01C93B1E0A4E02C91B1E065 +:1010C000A5E03C91B1E0A8E00C91B1E0A9E01C9151 +:1010D000EAE0FAE00995B1E0A4E02C93B1E0A5E0E4 +:1010E0003C93B1E0A3E12C91B1E0A4E13C91B1E0EB +:1010F000A4E00C91B1E0A5E01C91201B310BB1E004 +:10110000A3E12C93B1E0A4E13C93B1E0A4E000E3BF +:101110000C93B1E0A5E000E00C93B1E0A8E02C91C5 +:10112000B1E0A9E03C91B1E0A4E00C91B1E0A5E010 +:101130001C91200F311FB1E0A8E02C93B1E0A9E091 +:101140003C93B1E0A4E00EE00C93B1E0A5E000E038 +:101150000C93B1E0A4E00C91B1E0A5E01C91B1E0EA +:10116000A1E12C91B1E0A2E13C910217130741F4F7 +:10117000B1E0A8E00DE00C93B1E0A9E000E00C9331 +:10118000B1E0A4E00FE00C93B1E0A5E000E00C9327 +:10119000B1E0A4E00C91B1E0A5E01C91B1E0A1E1C7 +:1011A0002C91B1E0A2E13C910217130741F4B1E0A8 +:1011B000A8E00AE00C93B1E0A9E000E00C93B1E0F4 +:1011C000A1E10C91B1E0A2E11C9120E030E0021716 +:1011D00013070CF42CC0B1E0A1E00C9100610C935A +:1011E000B1E0A1E00C9104FF06C0B1E0A8E00C91D1 +:1011F000B0E0ACE90C93B1E0A1E00C910F7E0C9350 +:10120000B0E0ABE90C9105FD05C0B1E0A1E00C91A7 +:1012100000610C93B1E0AFE00C91B1E0A0E11C9152 +:10122000039509F413951C93B1E0AFE00C93B1E082 +:10123000A1E00C910B7F0C93B1E0AFE00C91B1E019 +:10124000A0E11C9120E130E0021713072CF4B1E07B +:10125000A1E00C9104600C93B1E0A1E00C91B1E02D +:10126000A1E01C9101FF1B7F01FD14601C93B1E004 +:10127000A1E00C9102FF08C0B1E0A5E108E70C93E2 +:10128000B1E0A6E100E00C93B1E0A1E00C91B1E087 +:10129000A1E01C9101FF1B7F01FD14601C93B1E0D4 +:1012A000A1E00C9102FF1EC0B1E0A7E10C91B1E0FA +:1012B000A8E11C9127EC30E00217130794F4B1E089 +:1012C000A7E10C91B1E0A8E11C91039509F41395F5 +:1012D0001C93B1E0A7E10C93B1E0A1E00C910B7F6E +:1012E0000C9308C0B1E0A7E100E00C93B1E0A8E1E5 +:1012F00000E00C93B1E0A1E00C91B1E0A1E01C9101 +:1013000002FF1F7E02FD10611C93B1E0AAE00C9168 +:1013100006FF05C0B1E0A1E00C910B7F0C93B1E09A +:10132000A1E00C91B1E0AAE01C9104FF1F7B04FD39 +:1013300010641C93B1E0A1E00C9102FF06C0B1E083 +:10134000A5E10C91B0E0ACE90C93B1E0A1E00C9107 +:101350000B7F0C93B0E0ABE90C9105FD05C0B1E04B +:10136000A1E00C9104600C93B1E0A1E00C91B1E01C +:10137000A1E01C9101FF1B7F01FD14601C93B1E0F3 +:10138000A1E00C9102FF19C0B1E0A1E00C910B7F2C +:101390000C93B0E0ABE90C9107FF0FC0B1E0A1E006 +:1013A0000C9104600C93B0E0ACE90C91B1E0A9E1C0 +:1013B0000C93B1E0AAE100E00C93B1E0A8E001E6F3 +:1013C0000C93B1E0A9E000E00C93B1E0A9E10C912D +:1013D000B1E0AAE11C91B1E0A8E02C91B1E0A9E054 +:1013E0003C910217130709F405C0B1E0A1E00C918C +:1013F0000B7F0C93B1E0A1E00C9102FF08C0B1E0BB +:10140000A2E000E00C93B1E0A3E000E00C93E1E97E +:10141000F0E00994551B441B60E110F4400F511F8C +:1014200020FD401B20FD510B55954795379527957D +:101430006A9599F70895D12ED32617FF04C0109509 +:1014400000950F5F1F4F37FF04C0309520952F5F29 +:101450003F4FEE24FF1841E1001F111F4A9539F458 +:10146000D7FE04C0109500950F5F1F4F0895EE1C26 +:10147000FF1CE21AF30A20F4E20EF31E8894ECCF6C +:041480000894EACF13 +:00000001FF diff --git a/test/ldTest/expected/contacts.hex b/test/ldTest/expected/contacts.hex new file mode 100644 index 0000000..5c653b7 --- /dev/null +++ b/test/ldTest/expected/contacts.hex @@ -0,0 +1,21 @@ +:020000040000FA +:100000008A110A1208280000000000000000000009 +:10001000283084005830A0008001840AA00B0C28EE +:10002000103095002730960000308E0000308F0091 +:10003000013090000B309700831686309F008312AA +:10004000003085008316DF30850083120030860083 +:100050008316FF3086008312003087008316FC3041 +:10006000870083120C1D32280C116400A914A918F2 +:100070002915A91C291105183E2829112919071429 +:10008000291D0710A9182915A91C2911A911291919 +:100090002916291D291285184E282912291E512892 +:1000A000A91529192916291D2912051958282912B7 +:1000B000291E5B28A915A9192915A91D2911291D72 +:1000C00062288516A9182915A91C291185196928DE +:1000D0002911051E6C282911A91229192917291D72 +:1000E0002913291F74288512291F7728A916291971 +:1000F0002917291D2913291F7F2887108028871475 +:10010000291F8328A916A91A2915A91E29118A01B0 +:02011000322893 +:02400E00723FFF +:00000001FF diff --git a/test/ldTest/expected/integers.hex b/test/ldTest/expected/integers.hex new file mode 100644 index 0000000..1e270a7 --- /dev/null +++ b/test/ldTest/expected/integers.hex @@ -0,0 +1,134 @@ +:1000000022C0189518951895189518951895189553 +:100010001895189518951895189518951895189578 +:100020001895189518951895189518951895189568 +:100030001895189518951895189518951895189558 +:10004000189518951895B0E0AEE504E00C93B0E073 +:10005000ADE50FEF0C93B5E0A0E000E020E034E068 +:10006000A150B0400C93215030402223C9F73323D4 +:10007000B9F7B0E0AAE304E00C93B0E0ABE300E032 +:100080000C93B0E0A7E300E00C93B0E0A8E301E03C +:100090000C93B0E0A4E300E00C93B0E0A5E300E033 +:1000A0000C93B0E0A1E300E40C93B0E0A2E300E025 +:1000B0000C93B0E0A6E200E00C93B0E0A7E200E011 +:1000C0000C93B0E0AFE400E00C93B0E0AEE40AE0E3 +:1000D0000C93B0E0ABE404EF0C93B0E0AAE402E2CE +:1000E0000C93B0E0A9E500E40C93B0E0A8E50C9116 +:1000F00006FFFBCFB0E0A8E50C9100640C93A89537 +:10010000B1E0A1E00C9102600C93B1E0A1E00C9190 +:10011000B1E0A1E01C9101FF1B7F01FD14601C9365 +:10012000B1E0A1E00C91077F0C93B1E0A1E00C914C +:10013000B1E0A1E01C9102FF1F7E02FD10611C9343 +:10014000B0E0A6E30C9100FD05C0B1E0A1E00C9188 +:100150000F7E0C93B1E0A1E00C9104FF08C0B1E068 +:10016000A2E00BE20C93B1E0A3E005E00C93B1E058 +:10017000A1E00C9104FF05C0B1E0A1E00C91086082 +:100180000C93B1E0A1E00C91B1E0A1E01C9102FF61 +:100190001F7E02FD10611C93B0E0A6E30C9100FFEE +:1001A00005C0B1E0A1E00C910F7E0C93B1E0A1E09D +:1001B0000C9104FF08C0B1E0A2E004EF0C93B1E0A1 +:1001C000A3E00FEF0C93B1E0A1E00C9104FF05C098 +:1001D000B1E0A1E00C9108600C93B1E0A1E00C91BA +:1001E000B1E0A1E01C9103FF1B7F03FD14601C9391 +:1001F000B1E0A1E00C91B1E0A1E01C9101FF1B7FF7 +:1002000001FD14601C93B1E0A1E00C910F7D0C93F3 +:10021000B1E0A1E00C91B1E0A1E01C9102FF1F7BD5 +:1002200002FD10641C93B1E0A1E00C9106FF1CC01C +:10023000B1E0A4E008EE0C93B1E0A5E003E00C937C +:10024000B1E0A2E02C91B1E0A3E03C91B1E0A4E0E8 +:100250000C91B1E0A5E01C91200F311FB1E0A6E0A8 +:100260002C93B1E0A7E03C93B1E0A1E00C9106FF34 +:1002700005C0B1E0A1E00C9100620C93B1E0A1E0F7 +:100280000C91B1E0A1E01C9102FF1F7B02FD106404 +:100290001C93B1E0A1E00C9106FF1CC0B1E0A4E00A +:1002A00005E00C93B1E0A5E000E00C93B1E0A2E022 +:1002B0002C91B1E0A3E03C91B1E0A4E00C91B1E05D +:1002C000A5E01C91201B310BB1E0A8E02C93B1E01C +:1002D000A9E03C93B1E0A1E00C9106FF05C0B1E0BC +:1002E000A1E00C9100620C93B1E0A1E00C91B1E0AF +:1002F000A1E01C9102FF1F7B02FD10641C93B1E082 +:10030000A1E00C9106FF1DC0B1E0A4E003E00C9356 +:10031000B1E0A5E000E00C93B1E0A2E02C91B1E0E7 +:10032000A3E03C91B1E0A4E00C91B1E0A5E01C9108 +:10033000ECEEF3E00995B1E0AAE02C93B1E0ABE07C +:100340003C93B1E0A1E00C9106FF05C0B1E0A1E053 +:100350000C9100620C93B1E0A1E00C91B1E0A1E03E +:100360001C9102FF1F7B02FD10641C93B1E0A1E011 +:100370000C9106FF1DC0B1E0A4E003E00C93B1E0D6 +:10038000A5E000E00C93B1E0A4E02C91B1E0A5E081 +:100390003C91B1E0AAE00C91B1E0ABE01C91EDEF33 +:1003A000F3E00995B1E0ACE00C93B1E0ADE01C9353 +:1003B000B1E0A1E00C9106FF05C0B1E0A1E00C9115 +:1003C00000620C93B1E0A1E00C91B1E0A1E01C91BE +:1003D00005FF1B7F05FD14601C93B1E0A1E00C91AB +:1003E000B1E0A1E01C9101FF1B7F01FD14601C9393 +:1003F000B1E0A1E00C910F770C93B1E0A1E00C917A +:10040000B1E0AEE01C9102FF1E7F02FD11601C9363 +:10041000B1E0A4E00BE20C93B1E0A5E005E00C93A1 +:10042000B1E0A2E00C91B1E0A3E01C91B1E0A4E046 +:100430002C91B1E0A5E03C910217130709F405C027 +:10044000B1E0AEE00C910E7F0C93B1E0AEE00C9108 +:1004500000FF05C0B1E0A1E00C9100680C93B1E091 +:10046000A1E00C91B1E0AEE01C9102FF1E7F02FD05 +:1004700011601C93B1E0AEE00C9100FF05C0B1E04B +:10048000A1E00C9100680C93B1E0A1E00C91B1E007 +:10049000A1E01C9107FF1B7F07FD14601C93B1E0D6 +:1004A000AEE00C910D7F0C93B1E0A1E00C91B1E0B6 +:1004B000AEE01C9102FF1B7F02FD14601C93B1E0B3 +:1004C000A4E000E00C93B1E0A5E000E00C93B1E003 +:1004D000A4E00C91B1E0A5E01C91B1E0A6E02C9164 +:1004E000B1E0A7E03C91201731070CF405C0B1E062 +:1004F000AEE00C910B7F0C93B1E0AEE00C9102FFEB +:1005000005C0B1E0AEE00C9102600C93B1E0A1E057 +:100510000C91B1E0AEE01C9102FF1B7F02FD146064 +:100520001C93B1E0A4E006E20C93B1E0A5E005E085 +:100530000C93B1E0A8E00C91B1E0A9E01C91B1E00E +:10054000A4E02C91B1E0A5E03C91201731072CF4F8 +:10055000B1E0AEE00C910B7F0C93B1E0AEE00C91FA +:1005600002FF05C0B1E0AEE00C9102600C93B1E077 +:10057000A1E00C91B1E0AEE01C9102FF1B7F02FDF7 +:1005800014601C93B1E0AEE00C9102FF05C0B1E035 +:10059000AEE00C9102600C93B1E0AEE00C91B1E0E2 +:1005A000A1E01C9101FF1B7F01FD14601C93B1E0D1 +:1005B000AEE00C91077F0C93B1E0A1E00C91B1E0AB +:1005C000AEE01C9102FF1F7E02FD10611C93B1E0A2 +:1005D000A4E000E20C93B1E0A5E00EE40C93B1E0DE +:1005E000A6E00C91B1E0A7E01C91B1E0A4E02C9151 +:1005F000B1E0A5E03C91201731070CF405C0B1E053 +:10060000AEE00C910F7E0C93B1E0AEE00C9104FFD4 +:1006100005C0B1E0AEE00C9108600C93B1E0A1E040 +:100620000C91B1E0AEE01C9102FF1F7E02FD106153 +:100630001C93B1E0A4E001E80C93B1E0A5E00FE069 +:100640000C93B1E0A4E00C91B1E0A5E01C91B1E005 +:10065000AAE02C91B1E0ABE03C91201731072CF4DB +:10066000B1E0AEE00C910F7E0C93B1E0AEE00C91E6 +:1006700004FF05C0B1E0AEE00C9108600C93B1E05E +:10068000A1E00C91B1E0AEE01C9102FF1F7E02FDE3 +:1006900010611C93B1E0AEE00C910F7E0C93B1E0C1 +:1006A000AEE00C9104FF05C0B1E0AEE00C91086033 +:1006B0000C93B1E0AEE00C91B1E0A1E01C9103FF1E +:1006C0001B7F03FD14601C93B1E0A1E00C91B0E02E +:1006D000ABE31C9102FF1B7F02FD14601C93B1E091 +:1006E000A1E00C91B1E0A1E01C9101FF1B7F01FD95 +:1006F00014601C93B1E0A4E00CED0C93B1E0A5E014 +:100700000FEF0C93B1E0AAE00C91B1E0ABE01C91CB +:10071000B1E0A4E02C91B1E0A5E03C9102171307F1 +:1007200029F4B1E0A1E00C910B7F0C93B1E0A4E0BF +:1007300000E00C93B1E0A5E000E00C93B1E0A2E092 +:100740000C91B1E0A3E01C91B1E0A4E02C91B1E0E8 +:10075000A5E03C91201731070CF405C0B1E0A1E001 +:100760000C910B7F0C93B1E0A1E00C9102FF1EC035 +:10077000B1E0AFE00C91B1E0A0E11C9123E130E0E9 +:100780000217130794F4B1E0AFE00C91B1E0A0E1DF +:100790001C91039509F413951C93B1E0AFE00C9301 +:1007A000B1E0A1E00C910B7F0C9308C0B1E0AFE089 +:1007B00000E00C93B1E0A0E100E00C93B1E0A1E017 +:1007C0000C91B0E0A2E31C9102FF1F7B02FD1064BC +:1007D0001C93E5E7F0E00994551B441B60E110F41D +:1007E000400F511F20FD401B20FD510B5595479593 +:1007F000379527956A9599F70895D12ED32617FF37 +:1008000004C0109500950F5F1F4F37FF04C030954F +:1008100020952F5F3F4FEE24FF1841E1001F111F6D +:100820004A9539F4D7FE04C0109500950F5F1F4F0D +:100830000895EE1CFF1CE21AF30A20F4E20EF31EE8 +:080840008894ECCF0894EACF84 +:00000001FF diff --git a/test/ldTest/expected/misc-ops.hex b/test/ldTest/expected/misc-ops.hex new file mode 100644 index 0000000..c3b7003 --- /dev/null +++ b/test/ldTest/expected/misc-ops.hex @@ -0,0 +1,69 @@ +:020000040000FA +:100000008A110A1208280000000000000000000009 +:10001000283084005830A0008001840AA00B0C28EE +:10002000103095002730960000308E0000308F0091 +:10003000013090000B309700831686309F008312AA +:10004000003085008316FD30850083120030860065 +:100050008316FF3086008312003087008316FD3040 +:10006000870083120C1D32280C116400A914A918F2 +:100070002915A91C291105183E282911A91842285B +:10008000A91446282919A914291DA910A918291548 +:10009000A91C2911A9194D282911291D64280030EE +:1000A0002B0203195A28A00020092B05A006A01B2B +:1000B0005F28632831302A02031C5F286328AA0FB7 +:1000C0006228AB0A291168280030AA000030AB0072 +:1000D000291A6E283130AC000030AD0029162919DC +:1000E000862800302D0203197C28A00020092D0548 +:1000F000A006A01B8128852831302C02031C8128F2 +:100100008528AC0F8428AD0A29158A280030AC0058 +:100110000030AD00291D8E28A9118F28A915A91816 +:100120002915A91C2911A91996282911291DB228B8 +:10013000A91AB2283008AE003108AF003208B0006A +:100140003308B1003408B2003508B3003608B400F3 +:100150003708B5003808B6003908B7003A08B800C3 +:100160003B08B9002919A916291DA912A918291592 +:10017000A91C291129132919A917291DA913A91F78 +:10018000D82851309F00831680309F00831206309C +:10019000A100A10BC9281F151F19CC281E08BD00DE +:1001A00083161E088312BC00831686309F008312BC +:1001B000A91FDB2829172919A917291DA913A91F68 +:1001C000E5283C08BA003D08BB00A91FE82829170C +:1001D000291B2915291F2911A9182915A91C29111D +:1001E0003E102919BE14291DBE10A919F828BE10E9 +:1001F000BE1C14293E191429BF0FFF28C00A003065 +:10020000400203190A29A00020094005A006A01BEE +:100210000F29102905303F02031C0F29102914292A +:100220000030BF000030C000BE183E15BE1C3E119D +:10023000BE1C1B293E142919BE14291DBE10BE1C4C +:1002400071290030C1000030C2003F084102031D87 +:10025000312940084202031D31290A30C300003011 +:10026000C4000130C1000030C2003F084102031D3C +:10027000412940084202031D41294630C300003095 +:10028000C4000230C1000030C2003F084102031D1B +:10029000512940084202031D51295030C30000304B +:1002A000C4000330C1000030C2003F084102031DFA +:1002B000612940084202031D61294630C300003015 +:1002C000C4000430C1000030C2003F084102031DD9 +:1002D000712940084202031D71290A30C300003011 +:1002E000C400BE1C74293E142919BE14291DBE1059 +:1002F000BE1C9E294308A000A1016430A200A301F6 +:1003000001308A00BB2101308A002308A1002208A5 +:10031000A0006430A200A30101308A00D221013084 +:100320008A0020089B00BE199E29BE1583166330E3 +:10033000920083120C309D0004309200BE1CA12953 +:100340003E143E1829153E1C2911A9182915A91C6F +:100350002911A918AD29A914B1292919A914291DF0 +:10036000A910A9182915A91C291129198514291DB5 +:1003700085108A013228A501A4010310A30CA20C48 +:100380001030A600031CCA292008A4070318A50AD8 +:100390002108A5070310A50CA40CA30CA20CA60B06 +:1003A000C229080021082306A700A31FDC29A209EF +:1003B000A309A20A0319A30AA11FE329A009A109FD +:1003C000A00A0319A10AA501A40103101130A60077 +:1003D000A00DA10DA6030319012AA40DA50D220845 +:1003E000A402031CA5032308A502A51FFF292208B8 +:1003F000A4070318A50A2308A5070310E829031476 +:10040000E829A71F0800A009A109A00A0319A10A49 +:020410000800E2 +:02400E00723FFF +:00000001FF diff --git a/test/ldTest/expected/pic16-hw.hex b/test/ldTest/expected/pic16-hw.hex new file mode 100644 index 0000000..e966538 --- /dev/null +++ b/test/ldTest/expected/pic16-hw.hex @@ -0,0 +1,189 @@ +:020000040000FA +:100000008A110A1208280000000000000000000009 +:10001000283084005830A0008001840AA00B0C28EE +:10002000103095002730960000308E0000308F0091 +:10003000013090000B309700831686309F008312AA +:10004000003085008316FF30850083120030860063 +:100050008316FF3086008312003087008316FD3040 +:1000600087008312003088008316FF3088008312D7 +:1000700000308900831607308900831283161930F7 +:1000800099008312831620309800831290309800D4 +:100090000C1D48280C116400A914A9182915A91CC5 +:1000A0002911291DD928A91989282912831603176E +:1000B0008C186F2883120313291C722803178D0ACA +:1000C0000313280803178C0083168C130C15553066 +:1000D0008D00AA308D008C14831203132910831213 +:1000E00003132916291A8928A915031700308D0032 +:1000F00083168C130C1483120C080313AA00031725 +:1001000001308D0083168C130C1483120C0803131A +:10011000AB002912831603178C18A328831203132C +:10012000291CA62803178D0A0313280803178C001F +:1001300083168C130C1555308D00AA308D008C144D +:10014000831203132910831203132916291AD9289D +:10015000031700308D0083168C130C1483120C08C7 +:100160000313AC00031701308D0083168C130C149D +:1001700083120C080313AD002C082A02031DC528A6 +:100180002D082B02031DC528D92829142B08A800E7 +:10019000031700308D0003132A0803178C00831601 +:1001A0008C130C1555308D00AA308D008C148312E1 +:1001B0000313A9182915A91C2911291DF62849304E +:1001C0009F00831680309F0083120630A100A10B90 +:1001D000E7281F151F19EA281E08AF0083161E08FE +:1001E0008312AE00831686309F008312A91829154A +:1001F000A91C2911A91229192917291D2913051824 +:1002000002292913291F0529A91629192917291D8A +:1002100029130030B0000230B1003109A1002F05D0 +:10022000A0002F08A104A10931082F0203192129D8 +:10023000A105A200220920052104A206A21B26294D +:10024000272930082E02031C262927292913291FB4 +:100250002A29A916A91A2915A91E29112919291609 +:10026000291D2912A91F35292911291AA917291E63 +:10027000A913291D4A290130B0000030B1002A0815 +:100280003007AA002010031820142B083107AB00F8 +:100290002018AB0AA9182915A91C291132102919EF +:1002A000B214291DB2100A30B0000030B10031097B +:1002B000A1002B05A0002B08A104A10931082B02E5 +:1002C00003196B29A105A200220920052104A20619 +:1002D000A21B7029712930082A02031C7029712978 +:1002E0007229B210B21C78291430B3000030B40067 +:1002F000B21C7B2932142919B214291DB2100A30FC +:10030000B0000030B1003109A1002B05A0002B087E +:10031000A104A10931082B0203199729A105A20004 +:10032000220920052104A206A21B9C299D29300830 +:100330002A02031C9C299D29B210B21CA329323029 +:10034000B3000030B400B21CA62932142919B2142B +:10035000291DB210B21CD0293308A000A1017D30A4 +:10036000A200A30105308A00812501308A002308FC +:10037000A1002208A0006430A200A30105308A0079 +:10038000982501308A0020089B003219D0293215A7 +:1003900083167C30920083120C309D000530920051 +:1003A000B21CD329321432182915321C2911A9186C +:1003B0002915A91C2911291DF2290030360203191B +:1003C000E829A00020093605A006A01BED29F12987 +:1003D00063303502031CED29F129B50FF029B60A67 +:1003E0002911F6290030B5000030B6002919291668 +:1003F000291D2912B21DFD292911291AB215291EFC +:10040000B211291D092A321A092A0030B70000301A +:10041000B80029193216291D32123708B9003808D8 +:10042000BA000030380203191C2AA0002009380540 +:10043000A006A01B212A222A10303702031C212AE1 +:10044000222A262AFF30B900FF30BA002912291EBD +:100450002B2A2C089900291283169818312A831206 +:1004600029168312291E382AFF30B900FF30BA003E +:100470000030AC000030AD002C083902031D482AC2 +:100480002D083A02031D482A7330B0000030B10035 +:100490000130AC000030AD002C083902031D582A91 +:1004A0002D083A02031D582A6130B0000030B10017 +:1004B0000230AC000030AD002C083902031D682A60 +:1004C0002D083A02031D682A7630B0000030B100D2 +:1004D0000330AC000030AD002C083902031D782A2F +:1004E0002D083A02031D782A6530B0000030B100B3 +:1004F0000430AC000030AD002C083902031D882AFE +:100500002D083A02031D882A6430B0000030B10083 +:100510000530AC000030AD002C083902031D982ACC +:100520002D083A02031D982A2030B0000030B10097 +:100530000630AC000030AD002C083902031DA82A9B +:100540002D083A02031DA82A3D30B0000030B1004A +:100550000730AC000030AD002C083902031DB82A6A +:100560002D083A02031DB82A2030B0000030B10037 +:100570000830AC000030AD0029122C083902031DF0 +:10058000C62A2D083A02031DC62A2916291EF32A57 +:100590002A08BB002B08BC002030B0000030B1009E +:1005A00000302B020319DB2AA00020092B05A0062E +:1005B000A01BE02AF32A00302A02031CE02AF32AB7 +:1005C0002D30B0000030B1000030AC000030AD0084 +:1005D0002A082C02BB002010031820142B082D021F +:1005E000BC00201CBC030930AC000030AD00291257 +:1005F0002C083902031D012B2D083A02031D012B83 +:100600002916291E542BB2161030AC002730AD002D +:100610003B08A0003C08A1002C08A2002D08A30064 +:1006200005308A00982503308A002008B000210890 +:10063000B1002C08A0002D08A1003008A20031084C +:10064000A30005308A00812503308A002208AC000F +:100650002308AD002C083B02BB0020100318201417 +:100660002D083C02BC00201CBC033030AC00003024 +:10067000AD0030082C07B0002010031820143108FA +:100680002D07B1002018B10A2C083002031D532B8E +:100690002D083102031D532BB21E522B2030B00007 +:1006A0000030B100542BB2120A30AC000030AD0063 +:1006B00029122C083902031D622B2D083A02031D52 +:1006C000622B2916291EB42BE830AC000330AD0094 +:1006D0003B08A0003C08A1002C08A2002D08A300A4 +:1006E00005308A00982503308A002008B0002108D0 +:1006F000B1002C08A0002D08A1003008A20031088C +:10070000A30005308A00812503308A002208AC004E +:100710002308AD002C083B02BB0020100318201456 +:100720002D083C02BC00201CBC033030AC00003063 +:10073000AD0030082C07B000201003182014310839 +:100740002D07B1002018B10A2C083002031DB32B6D +:100750002D083102031DB32BB21EB22B2030B00086 +:100760000030B100B42BB2120B30AC000030AD0041 +:1007700029122C083902031DC22B2D083A02031D31 +:10078000C22B2916291E142C6430AC000030AD0099 +:100790003B08A0003C08A1002C08A2002D08A300E3 +:1007A00005308A00982503308A002008B00021080F +:1007B000B1002C08A0002D08A1003008A2003108CB +:1007C000A30005308A00812503308A002208AC008E +:1007D0002308AD002C083B02BB0020100318201496 +:1007E0002D083C02BC00201CBC033030AC000030A3 +:1007F000AD0030082C07B000201003182014310879 +:100800002D07B1002018B10A2C083002031D132C4B +:100810002D083102031D132CB21E122C2030B00003 +:100820000030B100142CB2120C30AC000030AD001E +:1008300029122C083902031D222C2D083A02031D0F +:10084000222C2916291E742C0A30AC000030AD0071 +:100850003B08A0003C08A1002C08A2002D08A30022 +:1008600005308A00982504308A002008B00021084D +:10087000B1002C08A0002D08A1003008A20031080A +:10088000A30005308A00812504308A002208AC00CC +:100890002308AD002C083B02BB00201003182014D5 +:1008A0002D083C02BC00201CBC033030AC000030E2 +:1008B000AD0030082C07B0002010031820143108B8 +:1008C0002D07B1002018B10A2C083002031D732C2B +:1008D0002D083102031D732CB21E722C2030B00083 +:1008E0000030B100742CB2120D30AC000030AD00FD +:1008F00029122C083902031D822C2D083A02031DEF +:10090000822C2916291EC42C0130AC000030AD0009 +:100910003B08A0003C08A1002C08A2002D08A30061 +:1009200005308A00982504308A002008B00021088C +:10093000B1002C08A0002D08A1003008A200310849 +:10094000A30005308A00812504308A002208AC000B +:100950002308AD002C083B02BB0020100318201414 +:100960002D083C02BC00201CBC033030AC00003021 +:10097000AD0030082C07B0002010031820143108F7 +:100980002D07B1002018B10A0E30AC000030AD00C8 +:100990002C083902031DD42C2D083A02031DD42C37 +:1009A0000D30B0000030B1000F30AC000030AD00B1 +:1009B0002C083902031DE42C2D083A02031DE42CF7 +:1009C0000A30B0000030B10000303A020319EF2CB9 +:1009D000A00020093A05A006A01BF42CF52C00303D +:1009E0003902031CF42CF52C042D2916291EFA2C8F +:1009F00030089900291283169818002D83122916A1 +:100A00008312B70F042DB80A2911003038020319D8 +:100A1000102DA00020093805A006A01B152D162DAD +:100A200010303702031C152D162D2915A91829156C +:100A3000A91C2911291D202D7830BD000030BE00D1 +:100A4000A9182915A91C2911291D3B2D0030400288 +:100A50000319312DA00020094005A006A01B362D4A +:100A60003A2DC7303F02031C362D3A2DBF0F392DCA +:100A7000C00A29113F2D0030BF000030C0002919E5 +:100A80002916291D2912321F462D2911291A32171C +:100A9000291E3213291D4E2D3D0899002911831658 +:100AA0009818542D831229158312A9182915A91CE9 +:100AB0002911291D6B2D29118C1E6B2D1A08C100BF +:100AC000C20129159818672D1819672D6B2D1A0862 +:100AD0001A08181218166130B0000030B100410831 +:100AE0003002031D782D42083102031D782D792D27 +:100AF0002911291D7F2D0030AA000030AB008A018A +:100B00004828A501A4010310A30CA20C1030A600D4 +:100B1000031C902D2008A4070318A50A2108A50787 +:100B20000310A50CA40CA30CA20CA60B882D080086 +:100B300021082306A700A31FA22DA209A309A20A28 +:100B40000319A30AA11FA92DA009A109A00A03192D +:100B5000A10AA501A40103101130A600A00DA10D4A +:100B6000A6030319C72DA40DA50D2208A402031C7A +:100B7000A5032308A502A51FC52D2208A407031855 +:100B8000A50A2308A5070310AE2D0314AE2DA71F39 +:0E0B90000800A009A109A00A0319A10A080083 +:02400E00723FFF +:00000001FF diff --git a/test/ldTest/expected/timers-counters.hex b/test/ldTest/expected/timers-counters.hex new file mode 100644 index 0000000..7a46571 --- /dev/null +++ b/test/ldTest/expected/timers-counters.hex @@ -0,0 +1,119 @@ +:1000000022C0189518951895189518951895189553 +:100010001895189518951895189518951895189578 +:100020001895189518951895189518951895189568 +:100030001895189518951895189518951895189558 +:10004000189518951895B0E0AEE500E10C93B0E076 +:10005000ADE50FEF0C93B1E1A0E000E020E030E16E +:10006000A150B0400C93215030402223C9F73323D4 +:10007000B9F7B0E0AAE300E20C93B0E0ABE300E034 +:100080000C93B0E0A7E300E00C93B0E0A8E300E03D +:100090000C93B0E0A4E300E00C93B0E0A5E300E033 +:1000A0000C93B0E0A1E304E00C93B0E0A2E300E025 +:1000B0000C93B0E0A2E200E00C93B0E0A3E207E012 +:1000C0000C93B0E0A1E600E20C93B0E0A2E600E001 +:1000D0000C93B0E0A4E600E00C93B0E0A5E600E0ED +:1000E0000C93B0E0AFE400E00C93B0E0AEE409E0C4 +:1000F0000C93B0E0ABE40CE90C93B0E0AAE40EE39F +:100100000C93B0E0A7E500E10C93B0E0A6E50C91FC +:1001100004FFFBCFB0E0A6E50C9100610C93A8951D +:10012000B1E0A1E00C9102600C93B1E0A1E00C9170 +:10013000B1E0A1E01C9101FF1B7F01FD14601C9345 +:10014000B1E0A1E00C9103FD05C0B1E0A1E00C918C +:100150000B7F0C93B1E0A1E00C9104FD08C0B1E06D +:10016000A2E009E00C93B1E0A3E000E00C93B1E061 +:10017000A1E00C9100610C93B1E0A1E00C9102FDB3 +:100180001EC0B1E0A2E00C91B1E0A3E01C9129E017 +:1001900030E00217130794F4B1E0A2E00C91B1E053 +:1001A000A3E01C91039509F413951C93B1E0A2E020 +:1001B0000C93B1E0A1E00C9104600C9308C0B1E095 +:1001C000A2E000E00C93B1E0A3E000E00C93B1E00A +:1001D000A1E00C9102FF1EC0B1E0A4E00C91B1E0DF +:1001E000A5E01C9129E030E00217130794F4B1E078 +:1001F000A4E00C91B1E0A5E01C91039509F41395DE +:100200001C93B1E0A4E00C93B1E0A1E00C910B7F52 +:100210000C9308C0B1E0A4E000E00C93B1E0A5E0CD +:1002200000E00C93B1E0A1E00C9102FF06C0B1E048 +:10023000A1E00C91077F0C9305C0B1E0A1E00C9107 +:1002400008600C93B1E0A1E00C91B1E0A1E01C9139 +:1002500001FF1B7F01FD14601C93B1E0A1E00C9134 +:1002600003FD05C0B1E0A1E00C910B7F0C93B0E061 +:10027000A1E20C9102FD05C0B1E0A1E00C910B7F61 +:100280000C93B1E0A1E00C9102FF12C0B1E0A1E03B +:100290000C9105FD0DC0B1E0A6E00C91B1E0A7E026 +:1002A0001C91039509F413951C93B1E0A6E00C93FF +:1002B000B1E0A1E00C91B1E0A1E01C9102FF1F7D33 +:1002C00002FD10621C93B1E0A6E00C91B1E0A7E042 +:1002D0001C9124E130E00217130734F4B1E0A1E0EF +:1002E0000C910B7F0C9305C0B1E0A1E00C91046070 +:1002F0000C93B1E0A8E00C91B1E0A9E01C9127EECD +:1003000033E002171307C4F4B1E0A1E00C9102FF3F +:100310000DC0B1E0A8E00C91B1E0A9E01C910395FB +:1003200009F413951C93B1E0A8E00C93B1E0A1E0AF +:100330000C910B7F0C9305C0B1E0A1E00C9104601F +:100340000C93B1E0A1E00C91B0E0A2E61C9102FF99 +:100350001F7D02FD10621C93B1E0A1E00C91B1E0A1 +:10036000A1E01C9101FF1B7F01FD14601C93B1E013 +:10037000A1E00C9103FD05C0B1E0A1E00C910B7F61 +:100380000C93B0E0A1E20C9100FD05C0B1E0A1E04A +:100390000C910B7F0C93B1E0A1E00C9102FF21C006 +:1003A000B1E0A1E00C9106FD1CC0B1E0AAE001E0C3 +:1003B0000C93B1E0ABE000E00C93B1E0A6E02C912F +:1003C000B1E0A7E03C91B1E0AAE00C91B1E0ABE074 +:1003D0001C91201B310BB1E0A6E02C93B1E0A7E00B +:1003E0003C93B1E0A1E00C91B1E0A1E01C9102FFCF +:1003F0001F7B02FD10641C93B1E0A6E00C91B1E0FC +:10040000A7E01C912AE030E00217130734F4B1E0B2 +:10041000A1E00C910B7F0C9305C0B1E0A1E00C9121 +:1004200004600C93B1E0A1E00C91B0E0A2E31C9158 +:1004300002FF1B7F02FD14601C93B1E0A1E00C9150 +:10044000B1E0A1E01C9101FF1B7F01FD14601C9332 +:10045000B0E0A1E20C9101FD05C0B1E0A1E00C917A +:100460000B7F0C93B1E0A1E00C910F770C93B1E0FE +:10047000A1E00C91B1E0ACE01C9102FF1E7F02FDF7 +:1004800011601C93B1E0ACE00C91B1E0ACE01C91C8 +:1004900000FF1D7F00FD12601C93B1E0ACE00C91E9 +:1004A00002FF05C0B1E0ACE00C910E7F0C93B1E00F +:1004B000ACE00C91B1E0ACE01C9101FF1B7F01FDB1 +:1004C00014601C93B1E0ACE00C9100FF05C0B1E0FA +:1004D000A1E00C9100680C93B1E0A1E00C91B1E0B7 +:1004E000ACE01C9102FF1E7F02FD11601C93B1E085 +:1004F000ACE00C91B1E0ACE01C9100FF1D7F00FD71 +:1005000012601C93B1E0ACE00C9100FD0BC0B1E0B7 +:10051000ACE00C9103FF05C0B1E0ACE00C910160D0 +:100520000C9305C0B1E0ACE00C910E7F0C93B1E0F0 +:10053000ACE00C91B1E0ACE01C9101FF177F01FD34 +:1005400018601C93B1E0ACE00C9100FF05C0B1E075 +:10055000A1E00C9100680C93B1E0A1E00C91B1E036 +:10056000A1E01C9107FF1B7F07FD14601C93B1E005 +:10057000A1E00C9102FF08C0B1E0A8E000E00C93FC +:10058000B1E0A9E000E00C93B1E0A1E00C91B1E092 +:10059000A1E01C9101FF1B7F01FD14601C93B1E0E1 +:1005A000A1E00C9103FD05C0B1E0A1E00C910B7F2F +:1005B0000C93B1E0A1E00C9102FF26C0B1E0ACE0E9 +:1005C0000C9104FD21C0B1E0ADE00C91B1E0AEE0D2 +:1005D0001C91039509F413951C93B1E0ADE00C93C5 +:1005E000B1E0ADE00C91B1E0AEE01C9128E030E06C +:1005F000021713070CF408C0B1E0ADE000E00C9363 +:10060000B1E0AEE000E00C93B1E0A1E00C91B1E00C +:10061000ACE01C9102FF1F7E02FD10611C93B1E053 +:10062000A1E00C91B1E0A1E01C9101FF1B7F01FD55 +:1006300014601C93B1E0AFE003E00C93B1E0A0E1E3 +:1006400000E00C93B1E0ADE00C91B1E0AEE01C91A4 +:10065000B1E0AFE02C91B1E0A0E13C9102171307AB +:1006600009F405C0B1E0A1E00C910B7F0C93B1E05F +:10067000A1E00C91B1E0ACE01C9102FF1D7F02FDF6 +:1006800012601C93B1E0A1E00C9102FD0BC0B1E03F +:10069000ACE00C9105FF05C0B1E0A1E00C91046055 +:1006A0000C9305C0B1E0A1E00C910B7F0C93B1E07D +:1006B000ACE00C91B1E0ACE01C9101FF1F7D01FDAD +:1006C00010621C93B1E0ACE00C9106FD08C0B1E0F3 +:1006D000A1E103E10C93B1E0A2E100E00C93B1E0F1 +:1006E000ACE00C9100640C93B1E0A1E00C9102FD30 +:1006F0001EC0B1E0A1E10C91B1E0A2E11C9123E1A7 +:1007000030E00217130794F4B1E0A1E10C91B1E0DD +:10071000A2E11C91039509F413951C93B1E0A1E1AA +:100720000C93B1E0A1E00C9104600C9308C0B1E01F +:10073000A1E100E00C93B1E0A2E100E00C93B1E094 +:10074000A1E00C91B0E0ABE31C9102FF1F7D02FD24 +:0A07500010621C93E5E8F0E0099444 +:00000001FF diff --git a/test/ldTest/go.bat b/test/ldTest/go.bat new file mode 100644 index 0000000..5338cea --- /dev/null +++ b/test/ldTest/go.bat @@ -0,0 +1 @@ +@perl run-tests.pl diff --git a/test/ldTest/run-tests.pl b/test/ldTest/run-tests.pl new file mode 100644 index 0000000..91e81b8 --- /dev/null +++ b/test/ldTest/run-tests.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +if (not -d 'results/') { + mkdir 'results'; +} + +$c = 0; +for $test (<tests/*.ld>) { + $output = $test; + $output =~ s/^tests/results/; + $output =~ s/\.ld$/.hex/; + + unlink $output; + + $cmd = "../ldmicro.exe /c $test $output"; + system $cmd; + $c++; +} + +print "\ndifferences follow:\n"; +@diff = `diff -q results expected`; +for(@diff) { + print " $_"; +} +$fc = scalar @diff; +print "($fc difference(s)/$c)\n"; +if($fc == 0) { + print "pass!\n"; + exit(0); +} else { + print "FAIL\n"; + exit(-1); +} diff --git a/test/ldTest/tests/avr-hw.ld b/test/ldTest/tests/avr-hw.ld new file mode 100644 index 0000000..7053aa4 --- /dev/null +++ b/test/ldTest/tests/avr-hw.ld @@ -0,0 +1,61 @@ +LDmicro0.1 +MICRO=Atmel AVR ATmega128 64-TQFP +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=C:\depot\ldmicro\reg\expected\avr-hw.hex + +IO LIST + Xinc at 2 + Aanalog at 61 +END + +PROGRAM +RUNG + COMMENT The more hardware-oriented ops (PWM, ADC, UART, EEPROM), test for the\r\nAVRs. +END +RUNG + PERSIST saved +END +RUNG + READ_ADC Aanalog +END +RUNG + PARALLEL + CONTACTS Xinc 0 + GEQ Aanalog 512 + END + OSR + ADD saved saved 1 +END +RUNG + PARALLEL + SERIES + LES saved 10 + MOVE duty 20 + END + SERIES + GEQ saved 10 + MOVE duty 50 + END + SET_PWM duty 2000 + END +END +RUNG + TON Tfmtd 1000000 + OSR + FORMATTED_STRING saved 15 115 97 118 101 100 32 61 32 92 45 53 92 114 92 110 +END +RUNG + MOVE char 'x' +END +RUNG + TON Tutx 2000000 + OSR + UART_SEND char +END +RUNG + UART_RECV inchar + EQU inchar 'a' + MOVE saved 0 +END diff --git a/test/ldTest/tests/contacts.ld b/test/ldTest/tests/contacts.ld new file mode 100644 index 0000000..07dd6a1 --- /dev/null +++ b/test/ldTest/tests/contacts.ld @@ -0,0 +1,41 @@ +LDmicro0.1 +MICRO=Microchip PIC16F876 28-PDIP or 28-SOIC +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=C:\depot\ldmicro\reg\expected\contacts.hex + +IO LIST + Xa at 2 + Xb at 3 + Xc at 4 + Xd at 5 + Xe at 6 + Yf at 11 + Yg at 7 + Yh at 12 +END + +PROGRAM +RUNG + COMMENT All types of contacts (NO, NC), and all types of coils (normal, inverted, set,\r\nreset); also test series and parallel combinations. +END +RUNG + CONTACTS Xa 0 + COIL Yf 0 0 0 +END +RUNG + PARALLEL + CONTACTS Xb 0 + CONTACTS Xc 0 + END + COIL Yg 0 1 0 +END +RUNG + CONTACTS Xd 0 + CONTACTS Xe 1 + PARALLEL + COIL Yg 0 0 1 + COIL Yh 1 0 0 + END +END diff --git a/test/ldTest/tests/integers.ld b/test/ldTest/tests/integers.ld new file mode 100644 index 0000000..d38a597 --- /dev/null +++ b/test/ldTest/tests/integers.ld @@ -0,0 +1,61 @@ +LDmicro0.1 +MICRO=Atmel AVR ATmega162 40-PDIP +CYCLE=50000 +CRYSTAL=10000000 +BAUD=2400 +COMPILED=C:\depot\ldmicro\reg\expected\integers.hex + +IO LIST + Xa at 1 + Yno at 16 + Yok at 37 +END + +PROGRAM +RUNG + COMMENT Test integer variable manipulations: move, arithmetic, comparison. Also test\r\na 50 ms cycle time, and the ATmega162 (odd timer register locations). +END +RUNG + PARALLEL + SERIES + CONTACTS Xa 0 + MOVE a 1323 + END + SERIES + CONTACTS Xa 1 + MOVE a -12 + END + END +END +RUNG + PARALLEL + ADD c a 1000 + SUB d a 5 + MUL e a 3 + DIV f e 3 + END +END +RUNG + PARALLEL + EQU a 1323 + SHORT + END + PARALLEL + LES c 0 + LEQ d 1318 + SHORT + END + SHORT + PARALLEL + GRT c 20000 + GEQ e 3969 + OPEN + END + COIL Yok 0 0 0 +END +RUNG + NEQ e -36 + GRT a 0 + TON Ton 1000000 + COIL Yno 0 0 0 +END diff --git a/test/ldTest/tests/misc-ops.ld b/test/ldTest/tests/misc-ops.ld new file mode 100644 index 0000000..9fff1c4 --- /dev/null +++ b/test/ldTest/tests/misc-ops.ld @@ -0,0 +1,53 @@ +LDmicro0.1 +MICRO=Microchip PIC16F876 28-PDIP or 28-SOIC +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=C:\depot\ldmicro\reg\expected\misc-ops.hex + +IO LIST + Xon at 2 + Yalways at 3 + Ain at 4 +END + +PROGRAM +RUNG + COMMENT Little things: shift register, look-up table, master control relay.\r\n +END +RUNG + CONTACTS Xon 0 + MASTER_RELAY +END +RUNG + CONTACTS Rosc 0 + TON Ton 500000 + TOF Tof 500000 + COIL Rosc 1 0 0 +END +RUNG + CONTACTS Rosc 0 + SHIFT_REGISTER reg 7 +END +RUNG + PARALLEL + READ_ADC Ain + MOVE reg0 Ain + END +END +RUNG + PARALLEL + SERIES + CONTACTS Rosc 0 + CTC Ci 4 + END + LOOK_UP_TABLE duty Ci 5 0 10 70 80 70 10 + SET_PWM duty 10000 + END +END +RUNG + MASTER_RELAY +END +RUNG + COIL Yalways 0 0 0 +END diff --git a/test/ldTest/tests/pic16-hw.ld b/test/ldTest/tests/pic16-hw.ld new file mode 100644 index 0000000..9c9ec46 --- /dev/null +++ b/test/ldTest/tests/pic16-hw.ld @@ -0,0 +1,61 @@ +LDmicro0.1 +MICRO=Microchip PIC16F877 40-PDIP +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=C:\depot\ldmicro\reg\expected\pic-hw.hex + +IO LIST + Xinc at 2 + Aanalog at 3 +END + +PROGRAM +RUNG + COMMENT The more hardware-oriented ops (PWM, ADC, UART, EEPROM), test for the\r\nPIC16s. +END +RUNG + PERSIST saved +END +RUNG + READ_ADC Aanalog +END +RUNG + PARALLEL + CONTACTS Xinc 0 + GEQ Aanalog 512 + END + OSR + ADD saved saved 1 +END +RUNG + PARALLEL + SERIES + LES saved 10 + MOVE duty 20 + END + SERIES + GEQ saved 10 + MOVE duty 50 + END + SET_PWM duty 2000 + END +END +RUNG + TON Tfmtd 1000000 + OSR + FORMATTED_STRING saved 15 115 97 118 101 100 32 61 32 92 45 53 92 114 92 110 +END +RUNG + MOVE char 'x' +END +RUNG + TON Tutx 2000000 + OSR + UART_SEND char +END +RUNG + UART_RECV inchar + EQU inchar 'a' + MOVE saved 0 +END diff --git a/test/ldTest/tests/timers-counters.ld b/test/ldTest/tests/timers-counters.ld new file mode 100644 index 0000000..867c6ff --- /dev/null +++ b/test/ldTest/tests/timers-counters.ld @@ -0,0 +1,57 @@ +LDmicro0.1 +MICRO=Atmel AVR ATmega128 64-TQFP +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=C:\depot\ldmicro\reg\expected\timers-counters.ld + +IO LIST + Xdown at 2 + Xres at 3 + Xup at 4 + Ydown at 27 + Ypulse at 46 + Yup at 56 +END + +PROGRAM +RUNG + COMMENT Test all the timers (TON, TOF, RTO) and counters (CTC, CTU, CTD), and the\r\nreset (RES) instruction. Also test one-shots. +END +RUNG + CONTACTS Rosc 0 + TOF Tof 100000 + TON Ton 100000 + COIL Rosc 1 0 0 +END +RUNG + CONTACTS Rosc 0 + CONTACTS Xup 0 + CTU Ccnt 20 + RTO Trto 10000000 + COIL Yup 0 0 0 +END +RUNG + CONTACTS Rosc 0 + CONTACTS Xdown 0 + CTD Ccnt 10 + COIL Ydown 0 0 0 +END +RUNG + CONTACTS Xres 0 + PARALLEL + OSR + OSF + END + RES Trto +END +RUNG + CONTACTS Rosc 0 + CTC Ccirc 7 +END +RUNG + EQU Ccirc 3 + OSF + TOF Tpulse 200000 + COIL Ypulse 0 0 0 +END diff --git a/test/pic-adc.ld b/test/pic-adc.ld new file mode 100644 index 0000000..760475a --- /dev/null +++ b/test/pic-adc.ld @@ -0,0 +1,158 @@ +LDmicro0.1 +MICRO=Microchip PIC16F877 40-PDIP +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=c:\temp\asd.hex + +IO LIST + Xlimit at 2 + Yled at 22 + Ain at 3 +END + +PROGRAM +RUNG + COMMENT Serial/ADC test program for PIC16F877: read an ADC input, convert from integer to string\r\n(three ASCII chars), then send it out over the serial port. Display a message at startup: +END +RUNG + PARALLEL + SERIES + EQU Cinit 2 + MOVE initc 'a' + END + SERIES + EQU Cinit 3 + MOVE initc 'd' + END + SERIES + EQU Cinit 4 + MOVE initc 'c' + END + SERIES + PARALLEL + EQU Cinit 0 + EQU Cinit 5 + END + MOVE initc 13 + END + SERIES + PARALLEL + EQU Cinit 1 + EQU Cinit 6 + END + MOVE initc 10 + END + END +END +RUNG + TON Ttod 500000 + CONTACTS Rinitdone 1 + CONTACTS Rtxbusy 1 + UART_SEND initc + COIL Rtxbusy 0 0 0 +END +RUNG + CONTACTS Rtxbusy 0 + CTU Cinit 7 + COIL Rinitdone 0 0 0 +END +RUNG + COMMENT Clock for the ADC read and a circular counter that sequences it. Just block the\r\noscillator until the init sequence completes. +END +RUNG + CONTACTS Rinitdone 0 + CONTACTS Rosc 1 + TOF Tct1 50000 + TON Tct2 50000 + COIL Rosc 0 0 0 +END +RUNG + CONTACTS Rosc 0 + CTC Cchar 4 +END +RUNG + OSR + MOVE Cchar 3 +END +RUNG + COMMENT Read the A/D input, then saturate the input so that we only have to display three digits. +END +RUNG + PARALLEL + READ_ADC Ain + SERIES + LEQ Ain 999 + MOVE intval Ain + END + SERIES + GEQ Ain 1000 + MOVE intval 999 + END + END +END +RUNG + COMMENT Split the integer into the ones, tens, and hundreds digits. This is just cumbersome, but\r\nit does not waste much memory (the multiply and divide are subroutines in the PIC code). +END +RUNG + PARALLEL + DIV hundreds intval 100 + MUL hundredsv hundreds 100 + SUB wohundreds intval hundredsv + DIV tens wohundreds 10 + MUL tensv tens 10 + SUB ones wohundreds tensv + END +END +RUNG + COMMENT Now convert the ones, tens, and hundreds digits to ASCII characters by adding\r\nASCII character '0' (since the ASCII digits are contiguous in order). +END +RUNG + PARALLEL + ADD hunc hundreds '0' + ADD tensc tens '0' + ADD onesc ones '0' + END +END +RUNG + COMMENT Then send out the characters. For each line we must send out five characters:\r\nhundreds, tens, ones, ones, carriage return, newline; use a CTC to sequence. +END +RUNG + PARALLEL + SERIES + EQU Cchar 0 + MOVE outch hunc + END + SERIES + EQU Cchar 1 + MOVE outch tensc + END + SERIES + EQU Cchar 2 + MOVE outch onesc + END + SERIES + EQU Cchar 3 + MOVE outch 13 + END + SERIES + EQU Cchar 4 + MOVE outch 10 + END + END +END +RUNG + COMMENT Time it off Rosc (10 characters/s) which is slow so ignore the busy out. +END +RUNG + CONTACTS Rosc 0 + OSR + UART_SEND outch +END +RUNG + PARALLEL + CONTACTS Rosc 0 + CONTACTS Xlimit 1 + END + COIL Yled 0 0 0 +END diff --git a/test/serial.ld b/test/serial.ld new file mode 100644 index 0000000..1285e4f --- /dev/null +++ b/test/serial.ld @@ -0,0 +1,92 @@ +LDmicro0.1 +MICRO=Microchip PIC16F877 40-PDIP +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 +COMPILED=c:\temp\ser.hex + +IO LIST + Yled at 22 +END + +PROGRAM +RUNG + CONTACTS Rosc 1 + TOF Tct1 250000 + TON Tct2 250000 + COIL Rosc 0 0 0 +END +RUNG + CONTACTS Rfast 1 + TOF Tct3 100000 + TON Tct4 100000 + COIL Rfast 0 0 0 +END +RUNG + CONTACTS Rosc 0 + CTC Cwhich 4 +END +RUNG + PARALLEL + SERIES + EQU Cwhich 0 + MOVE ch 'A' + END + SERIES + EQU Cwhich 1 + MOVE ch 'b' + END + SERIES + EQU Cwhich 2 + MOVE ch 'c' + END + SERIES + EQU Cwhich 3 + MOVE ch 13 + END + SERIES + EQU Cwhich 4 + MOVE ch 10 + END + END +END +RUNG + CONTACTS Rosc 0 + OSF + UART_SEND ch +END +RUNG + UART_RECV inch + COIL Rjustgot 0 1 0 +END +RUNG + CONTACTS Rjustgot 0 + TON Tnew 1000000 + COIL Rjustgot 0 0 1 +END +RUNG + PARALLEL + SERIES + CONTACTS Rjustgot 0 + CONTACTS Rfast 0 + END + SERIES + CONTACTS Rjustgot 1 + PARALLEL + SERIES + EQU inch 'o' + SHORT + END + SERIES + EQU inch 'b' + CONTACTS Rosc 0 + END + SERIES + SHORT + OPEN + END + END + END + END + COIL Yled 0 0 0 +END diff --git a/test/traffic.ld b/test/traffic.ld new file mode 100644 index 0000000..cc716d6 --- /dev/null +++ b/test/traffic.ld @@ -0,0 +1,73 @@ +LDmicro0.1 +MICRO=Atmel AVR ATmega128 64-TQFP +CYCLE=10000 +CRYSTAL=4000000 +COMPILED=C:\depot\ldmicro\out.hex + +IO LIST + Xbutton1 at 46 + Xbutton2 at 45 + Ygreen at 49 + Yred at 51 + Ywait at 48 + Yyellow at 50 +END + +PROGRAM +RUNG + CONTACTS Rclock 1 + TOF Ton 500000 + TON Toff 500000 + COIL Rclock 0 0 0 +END +RUNG + CONTACTS Rclock 0 + CTC Ccycle 19 +END +RUNG + GEQ Ccycle 0 + LES Ccycle 8 + COIL Yred 0 0 0 +END +RUNG + GEQ Ccycle 8 + LES Ccycle 12 + COIL Yyellow 0 0 0 +END +RUNG + GEQ Ccycle 12 + LES Ccycle 20 + PARALLEL + COIL Ygreen 0 0 0 + COIL Rwait 0 0 1 + END +END +RUNG + PARALLEL + CONTACTS Xbutton1 1 + CONTACTS Xbutton2 1 + END + PARALLEL + SERIES + GEQ Ccycle 0 + LES Ccycle 6 + MOVE cycle 6 + END + COIL Rwait 0 1 0 + END +END +RUNG + CONTACTS Rwait 0 + PARALLEL + SERIES + GEQ Ccycle 8 + LES Ccycle 12 + CONTACTS Rclock 0 + END + SERIES + GEQ Ccycle 0 + LES Ccycle 8 + END + END + COIL Ywait 0 0 0 +END diff --git a/test/var-timer.ld b/test/var-timer.ld new file mode 100644 index 0000000..a7b28fb --- /dev/null +++ b/test/var-timer.ld @@ -0,0 +1,63 @@ +LDmicro0.1 +CYCLE=10000 +CRYSTAL=4000000 +BAUD=2400 + +IO LIST + Xin at 0 + Yout at 0 + Apot at 0 +END + +PROGRAM +RUNG + COMMENT This is the actual variable-delay TOF timer. When Rdel_input goes high, Rdel_output goes high \r\nt_max cycle times later. When Rdel_input goes low, Rdel_output goes low immediately. +END +RUNG + CONTACTS Rdel_input 0 + LEQ t_count t_max + ADD t_count t_count 1 +END +RUNG + CONTACTS Rdel_input 1 + MOVE t_count 0 +END +RUNG + COMMENT The extra branch is to make a delay of 0 cycles work correctly. +END +RUNG + PARALLEL + GRT t_count t_max + SERIES + CONTACTS Rdel_input 0 + EQU t_max 0 + END + END + COIL Rdel_output 0 0 0 +END +RUNG + COMMENT \r\n +END +RUNG + COMMENT This is just an example of how to use the timer. The voltage attached to Apot (which goes\r\nfrom 0 V to Vdd) sets the delay between when Xin goes high and when Yout goes high. +END +RUNG + READ_ADC Apot +END +RUNG + COMMENT This only works with a cycle time of 10 ms. If we want the delay to be between 0 s and 5 s,\r\nthen it should be 0 to 500 cycle times; the ADC goes from 0 to 1023, so (roughly) divide by 2. +END +RUNG + DIV t_max Apot 2 +END +RUNG + COMMENT Then just hook up the input and the output of the timer to pins. Of course\r\nthat could drive more complicated logic, not just a pin on the processor. +END +RUNG + CONTACTS Xin 0 + COIL Rdel_input 0 0 0 +END +RUNG + CONTACTS Rdel_output 0 + COIL Yout 0 0 0 +END |