pc104

How to read a value of an hard coded address in C++?

这一生的挚爱 提交于 2020-01-14 08:13:09
问题 I am looking to read the value that is located in address 302H. The purpose is to read an input from hardware (a part of a 104pc stack). When I run the following code a get this error: Unhandled exception at 0x004134b9 in setOutput.exe: 0xC0000005: Access violation reading location 0x00000302. #include <stdlib.h> #define PORTBASE 0x302 int _tmain(int argc, char *argv[]) { int value; int volatile * port = (int *) PORTBASE; printf("port = %d\n", port); value = *port; printf("port value = %d\n",

How to read a value of an hard coded address in C++?

自古美人都是妖i 提交于 2020-01-14 08:12:12
问题 I am looking to read the value that is located in address 302H. The purpose is to read an input from hardware (a part of a 104pc stack). When I run the following code a get this error: Unhandled exception at 0x004134b9 in setOutput.exe: 0xC0000005: Access violation reading location 0x00000302. #include <stdlib.h> #define PORTBASE 0x302 int _tmain(int argc, char *argv[]) { int value; int volatile * port = (int *) PORTBASE; printf("port = %d\n", port); value = *port; printf("port value = %d\n",