Click here to Skip to main content
15,915,663 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: TFS on/in the cloud Pin
bkelly1317-Feb-14 6:44
bkelly1317-Feb-14 6:44 
Questioni/o registers that control cash drawer Pin
Member 1060107316-Feb-14 10:36
Member 1060107316-Feb-14 10:36 
AnswerRe: i/o registers that control cash drawer Pin
Richard Andrew x6416-Feb-14 11:14
professionalRichard Andrew x6416-Feb-14 11:14 
GeneralRe: i/o registers that control cash drawer Pin
Member 1060107316-Feb-14 11:31
Member 1060107316-Feb-14 11:31 
GeneralRe: i/o registers that control cash drawer Pin
Richard Andrew x6416-Feb-14 11:36
professionalRichard Andrew x6416-Feb-14 11:36 
AnswerRe: i/o registers that control cash drawer Pin
Richard MacCutchan16-Feb-14 22:28
mveRichard MacCutchan16-Feb-14 22:28 
GeneralRe: i/o registers that control cash drawer Pin
Member 1060107319-Feb-14 8:25
Member 1060107319-Feb-14 8:25 
GeneralRe: i/o registers that control cash drawer Pin
enhzflep19-Feb-14 18:17
enhzflep19-Feb-14 18:17 
Page 18 of the manual describes a technique by which you can manipulate the value of port 0x4B8 by using the debug.exe program while running under DOS or Win98.

Assuming the (cash) register has it's own OS and that I/O ports are accessible to user programs, you can simply use the inp/outp functions as found in <conio.h>.

Using the first example given in table 4.2.3, I've extended the table by 1 column to include the equivalent C code.

Command    |    Cash Drawer 1    |   C code
-----------------------------------------------------------
O 4B8 01   |    Opening          | outp(0x4B8, 0x01);
O 4B8 00   |    Allow to closing | outp(0x4B8, 0x00);


Looking at the second table, one can see that a read of the port is required along with bit-masking to get at the desired bit.

1. Read the value.
2. Mask the unwanted bits.
3. Check the value remaining.

C++
unsigned int curStatus = inp(0x4B8);
curStatus = curStatus & 0x10;  // 0x10 = 0001 000 in binary. Right-most bit is bit0, 4 bits per hexadecimal digit.
if (curStatus == 0)
  printf("Drawer is open\n");  // bit 4 wasn't set
else
  printf("Drawer is closed\n");

GeneralRe: i/o registers that control cash drawer Pin
Member 1060107320-Feb-14 9:16
Member 1060107320-Feb-14 9:16 
GeneralRe: i/o registers that control cash drawer Pin
enhzflep20-Feb-14 16:40
enhzflep20-Feb-14 16:40 
GeneralRe: i/o registers that control cash drawer Pin
Member 1060107320-Feb-14 20:01
Member 1060107320-Feb-14 20:01 
GeneralRe: i/o registers that control cash drawer Pin
enhzflep20-Feb-14 20:17
enhzflep20-Feb-14 20:17 
QuestionHandling mouse using OS interrupts Pin
myth199015-Feb-14 18:03
myth199015-Feb-14 18:03 
AnswerRe: Handling mouse using OS interrupts Pin
Richard MacCutchan15-Feb-14 21:29
mveRichard MacCutchan15-Feb-14 21:29 
GeneralRe: Handling mouse using OS interrupts Pin
myth199015-Feb-14 22:31
myth199015-Feb-14 22:31 
GeneralRe: Handling mouse using OS interrupts Pin
Software_Developer16-Feb-14 2:01
Software_Developer16-Feb-14 2:01 
GeneralRe: Handling mouse using OS interrupts Pin
myth199016-Feb-14 2:13
myth199016-Feb-14 2:13 
GeneralRe: Handling mouse using OS interrupts Pin
Software_Developer16-Feb-14 3:28
Software_Developer16-Feb-14 3:28 
GeneralRe: Handling mouse using OS interrupts Pin
myth199017-Feb-14 2:29
myth199017-Feb-14 2:29 
GeneralRe: Handling mouse using OS interrupts Pin
myth199022-Feb-14 17:59
myth199022-Feb-14 17:59 
GeneralRe: Handling mouse using OS interrupts Pin
Richard MacCutchan16-Feb-14 2:15
mveRichard MacCutchan16-Feb-14 2:15 
GeneralRe: Handling mouse using OS interrupts Pin
myth199016-Feb-14 2:21
myth199016-Feb-14 2:21 
GeneralRe: Handling mouse using OS interrupts Pin
Richard MacCutchan16-Feb-14 2:28
mveRichard MacCutchan16-Feb-14 2:28 
GeneralRe: Handling mouse using OS interrupts Pin
myth199016-Feb-14 2:32
myth199016-Feb-14 2:32 
Questionredirecting output of CMD with administrator privileges Pin
camillo8715-Feb-14 1:29
camillo8715-Feb-14 1:29 

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.