KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have ICOP VDX-6354 board running Win CE. I'm trying to control the buzzer of the board from my C# program. I tried all the playsound etc "coredll.dll" platform invokes. none of them worked so far. So my last chance is to create my own DLL. unsigned char inp(short addr) { unsigned char cValue; _asm { mov dx, addr in ax, dx mov cValue, al } return cValue; } void outp(int addr, unsigned char val) { __asm { push edx mov edx, DWORD PTR addr mov al, BYTE PTR val out dx, al pop edx } } bool MyBeep(DWORD dwFreq, DWORD dwDuration) { outp(0x43, 0xb6); // Set Buzzer outp(0x42, (0x1234dc / dwFreq)); // Frequency LSB outp(0x42, (0x1234dc / dwFreq) >> 8); // Frequency MSB outp(0x61, inp(0x61) | 0x3); // Start beep Sleep(dwDuration); outp(0x61, inp(0x61) & 0xfc); // End beep return TRUE; } The code above is available in the datasheet of the board. I want to compile it as a DLL then invoke it in my C# program like [DllImport("Buzzer.dll", EntryPoint = "MyBeep")] public static extern void MyBeep(uint dwFreq, uint dwDuration); I used a prefix as follows when I compiled: extern "C" __declspec(dllexport) bool MyBeep(DWORD dwFreq, DWORD dwDuration) So that hopefully I would be able to control the buzzer. My problem is I couldn't be successful compiling it. I followed the steps here but it didn't help me. What should I do step by step? EDIT: I think I built the DLL. I tried another way to build the DLL found here . Now, I copied the DLL to my C# startup project's Debug folder(Other DLLs of the project are also in this folder). Then I t
Tags (comma-separated)
Save Edits
Cancel