Click here to Skip to main content
15,886,799 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
GeneralRe: Screen black-outs Pin
Sebastian Schneider15-Jun-09 23:21
Sebastian Schneider15-Jun-09 23:21 
GeneralRe: Screen black-outs Pin
Kevnar20-Jun-09 12:12
Kevnar20-Jun-09 12:12 
GeneralRe: Screen black-outs Pin
Kevnar20-Jun-09 12:29
Kevnar20-Jun-09 12:29 
GeneralRe: Screen black-outs Pin
Luc Pattyn20-Jun-09 12:33
sitebuilderLuc Pattyn20-Jun-09 12:33 
GeneralRe: Screen black-outs Pin
Dan Neely22-Jun-09 2:22
Dan Neely22-Jun-09 2:22 
AnswerRe: Screen black-outs Pin
Michael Dunn21-Jun-09 22:09
sitebuilderMichael Dunn21-Jun-09 22:09 
AnswerRe: Screen black-outs Pin
SleepRequired4-Jul-09 14:08
SleepRequired4-Jul-09 14:08 
Questionproblem sending on rs232 Pin
August Brower8-Jun-09 18:37
August Brower8-Jun-09 18:37 
I am creating a program for a children's ATM for the local kids museum, and I'm having problems sending data to the machine (over RS232). I am using a .dll supplied by the manufacturer that is used to interface the dispenser with a computer. I think the problem is in sending the hex characters to the machine. I open the port find (according to the generated log file), but then I send and don't recieve the ACK. here is the pertinent part of the code. thanks for any help

#include "stdafx.h"
#include <windows.h>




typedef struct
{
unsigned int uiPort; //communication port
unsigned char ucDataBits; //Data bit
unsigned char ucParity; //Parity bit
unsigned char ucStopBits; //Stop bit
unsigned long dwBaudRate; //Baud Rate
HWND hwnd; //Parent window handle
unsigned char ucCommandType; //command type(1: ezCDM-1000 )
}SETINFO;



typedef unsigned int (*EZLINKOPEN)(SETINFO* setInfo);
typedef unsigned int (*EZLINKCLOSE)(void);
typedef unsigned int (*EZLINKPATH)(PCHAR pcMessage);
typedef unsigned int (*EZLINKSEND)(DWORD dwCmdExcuteTime, PUCHAR pcMessage, UINT uiCmdSize);
typedef unsigned int (*EZLINKRCV)(PUCHAR pcMessage, UINT *piRspSize);



int _tmain(int argc, _TCHAR* argv[])
{
//Loading dll------------------------------------------------------------------------------------------


HINSTANCE hdll = NULL;
hdll = LoadLibrary(TEXT("ezlink")); //load the dll


if (hdll == NULL)
{
printf("Didn't load dll\n"); //tell me if it failed
}

//Mapping the dll's functions--------------------------------------------------------------------------------

EZLINKOPEN ezLinkOpen;
EZLINKCLOSE ezLinkClose;
EZLINKPATH ezLinkPath;
EZLINKSEND ezLinkSend;
EZLINKRCV ezLinkRcv;



ezLinkOpen = (EZLINKOPEN)GetProcAddress(hdll,"ezLinkOpen");
ezLinkClose = (EZLINKCLOSE)GetProcAddress(hdll,"ezLinkClose");
ezLinkPath = (EZLINKPATH)GetProcAddress(hdll,"ezLinkPath");
ezLinkSend = (EZLINKSEND)GetProcAddress(hdll,"ezLinkSend");
ezLinkRcv = (EZLINKRCV)GetProcAddress(hdll,"ezLinkRcv");


//handle the error
if(!ezLinkOpen) //end program if dll mapping fails fails
{
FreeLibrary(hdll);
printf("Failed to map open function!\n");
return -1;
}

else //otherwise, lets send some commands
{
unsigned int result;


//Setting the log path--------------------------------------------------------------------------------------------
char message[] = "C:\\Documents and Settings\\august brower\\My Documents\\Visual Studio 2008\\Projects\\cash machine";
result = ezLinkPath((PCHAR) &message);
printf("Result of Path: '%i'\n", result);

//Opening the port---------------------------------------------------------------------------------------------------
SETINFO pSetInfo;

pSetInfo.uiPort =3;
pSetInfo.ucDataBits = 8;
pSetInfo.ucParity = 2;
pSetInfo.ucStopBits = 0;
pSetInfo.dwBaudRate = 9600;
pSetInfo.hwnd = GetActiveWindow();
pSetInfo.ucCommandType = 1;

result = ezLinkOpen(&pSetInfo);
printf("Result of Open: '%i'\n", result);

unsigned char response[20] ;

UINT *rspSize;
rspSize = (PUINT)malloc(sizeof(UINT));


//Sending commands
unsigned char command[6] = {0x01,0x30,0x02,0x50,0x03,0x60};
unsigned char command9[1] = {0x06};
unsigned char command1[12] = {0x01,0x30,0x02,0x4B,0x42,0x32,0x42,0x32,0x42,0x32,0x03,0x0B};
unsigned char command2[7] = {0x01,0x30,0x02,0x42,0x21,0x03,0x53};

PUCHAR cassette; //check cassette
PUCHAR ack; //acknowledge
PUCHAR bill; //set bill dimensions
PUCHAR dispense; //dispense 1 bill


cassette = command;
ack = command9;
bill= command1;
dispense=command2;

//--get cassette info-------------------------------------------------
result = ezLinkSend(4000,cassette;message,6);
printf("Result of Send: '%i'\n", result);

result = ezLinkRcv(response,rspSize);
printf("Result of Receive: '%i'\n", result);

result = ezLinkRcv(response,rspSize);
printf("Result of Receive: '%i'\n", result);

result = ezLinkSend(4000,ack,1);
printf("Result of Send: '%i'\n", result);
AnswerRe: problem sending on rs232 Pin
mansurp3-Sep-09 6:47
mansurp3-Sep-09 6:47 
QuestionNetworked Samsung SCX-4500W printer IP address changes preventing printer use Pin
Jonathan Davies8-Jun-09 4:33
Jonathan Davies8-Jun-09 4:33 
AnswerRe: Networked Samsung SCX-4500W printer IP address changes preventing printer use Pin
Dave Kreskowiak8-Jun-09 10:39
mveDave Kreskowiak8-Jun-09 10:39 
GeneralRe: Networked Samsung SCX-4500W printer IP address changes preventing printer use Pin
Jonathan Davies8-Jun-09 13:45
Jonathan Davies8-Jun-09 13:45 
QuestionHow can I [quickly] differentiate a USB card reader impersonating a keyboard, from the real keyboard? Pin
Neophyte305-Jun-09 2:57
Neophyte305-Jun-09 2:57 
AnswerRe: How can I [quickly] differentiate a USB card reader impersonating a keyboard, from the real keyboard? Pin
Randor 5-Jun-09 7:43
professional Randor 5-Jun-09 7:43 
GeneralRe: How can I [quickly] differentiate a USB card reader impersonating a keyboard, from the real keyboard? Pin
Neophyte3011-Jun-09 3:41
Neophyte3011-Jun-09 3:41 
QuestionUsb miniport device driver EvtUsbTargetPipeReadersFailed Pin
Ridvan Tekdogan1-Jun-09 0:42
Ridvan Tekdogan1-Jun-09 0:42 
QuestionRe: Usb miniport device driver EvtUsbTargetPipeReadersFailed Pin
Randor 1-Jun-09 3:16
professional Randor 1-Jun-09 3:16 
AnswerRe: Usb miniport device driver EvtUsbTargetPipeReadersFailed Pin
Ridvan Tekdogan2-Jun-09 1:54
Ridvan Tekdogan2-Jun-09 1:54 
GeneralRe: Usb miniport device driver EvtUsbTargetPipeReadersFailed Pin
Randor 5-Jun-09 7:49
professional Randor 5-Jun-09 7:49 
GeneralRe: Usb miniport device driver EvtUsbTargetPipeReadersFailed Pin
flyball123023-Nov-11 20:18
flyball123023-Nov-11 20:18 
Questionhow to know by coding between two computer ? Pin
xingselex29-May-09 7:05
xingselex29-May-09 7:05 
AnswerRe: how to know by coding between two computer ? Pin
Luc Pattyn29-May-09 7:46
sitebuilderLuc Pattyn29-May-09 7:46 
GeneralRe: how to know by coding between two computer ? Pin
xingselex30-May-09 5:49
xingselex30-May-09 5:49 
GeneralRe: how to know by coding between two computer ? Pin
Luc Pattyn30-May-09 6:11
sitebuilderLuc Pattyn30-May-09 6:11 
GeneralRe: how to know by coding between two computer ? Pin
xingselex30-May-09 6:27
xingselex30-May-09 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.