├── .gitignore ├── .vscode └── extensions.json ├── test └── README ├── platformio.ini ├── lib └── README ├── include └── README ├── .travis.yml ├── src └── main.cpp └── Utilities.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:megaatmega2560] 12 | platform = atmelavr 13 | board = megaatmega2560 14 | framework = arduino 15 | 16 | lib_deps = 17 | paulstoffregen/TimerOne @ ^1.1 18 | -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < https://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < https://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < https://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choose one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # - platformio update 39 | # 40 | # script: 41 | # - platformio run 42 | 43 | 44 | # 45 | # Template #2: The project is intended to be used as a library with examples. 46 | # 47 | 48 | # language: python 49 | # python: 50 | # - "2.7" 51 | # 52 | # sudo: false 53 | # cache: 54 | # directories: 55 | # - "~/.platformio" 56 | # 57 | # env: 58 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 59 | # - PLATFORMIO_CI_SRC=examples/file.ino 60 | # - PLATFORMIO_CI_SRC=path/to/test/directory 61 | # 62 | # install: 63 | # - pip install -U platformio 64 | # - platformio update 65 | # 66 | # script: 67 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 68 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define PIN_MEMW 21 4 | #define PIN_MEMR 20 5 | #define PIN_IOW 19 6 | #define PIN_IOR 18 7 | 8 | #define PIN_RESET 17 9 | #define PIN_AEN 16 10 | #define PIN_ALE 15 11 | #define PIN_IOCHRDY 14 12 | #define PIN_REFRESH 2 13 | 14 | #define PORT_ADDR0 PORTA // [A0:A7] 15 | #define PORT_ADDR8 PORTC // [A8:A15] 16 | #define PORT_ADDR16 PORTL // [A16:A19] 17 | #define PORT_DATA PORTK 18 | #define PIN_DATA PINK 19 | 20 | #define DDR_ADDR0 DDRA 21 | #define DDR_ADDR8 DDRC 22 | #define DDR_ADDR16 DDRL 23 | #define DDR_DATA DDRK 24 | 25 | void ioWrite(uint32_t address, uint8_t data) 26 | { 27 | PORT_ADDR0 = address & 0xFF; 28 | PORT_ADDR8 = (address >> 8) & 0xFF; 29 | PORT_ADDR16 = (address >> 16) & 0xFF; 30 | 31 | //digitalWrite(PIN_ALE, HIGH); 32 | //digitalWrite(PIN_ALE, LOW); 33 | 34 | PORT_DATA = data; 35 | DDR_DATA = 0xFF; 36 | 37 | digitalWrite(PIN_IOW, LOW); 38 | //delay(1); 39 | 40 | while (!digitalRead(PIN_IOCHRDY)) 41 | { 42 | } 43 | 44 | digitalWrite(PIN_IOW, HIGH); 45 | //delay(1); 46 | 47 | DDR_DATA = 0x00; 48 | } 49 | 50 | uint8_t ioRead(uint32_t address) 51 | { 52 | uint8_t data = 0x00; 53 | 54 | PORT_ADDR0 = address & 0xFF; 55 | PORT_ADDR8 = (address >> 8) & 0xFF; 56 | PORT_ADDR16 = (address >> 16) & 0xFF; 57 | 58 | //igitalWrite(PIN_ALE, HIGH); 59 | //digitalWrite(PIN_ALE, LOW); 60 | 61 | PORT_DATA = 0xFF; // pullup data bus 62 | DDR_DATA = 0x00; 63 | digitalWrite(PIN_IOR, LOW); 64 | //delay(1); 65 | 66 | while (!digitalRead(PIN_IOCHRDY)) 67 | { 68 | } 69 | 70 | data = PIN_DATA; 71 | 72 | digitalWrite(PIN_IOR, HIGH); 73 | //delay(1); 74 | 75 | return data; 76 | } 77 | 78 | void memWrite(uint32_t address, uint8_t data) 79 | { 80 | PORT_DATA = data; 81 | DDR_DATA = 0xFF; 82 | 83 | PORT_ADDR0 = address & 0xFF; 84 | PORT_ADDR8 = (address >> 8) & 0xFF; 85 | PORT_ADDR16 = (address >> 16) & 0xFF; 86 | 87 | //digitalWrite(PIN_ALE, HIGH); 88 | 89 | //digitalWrite(PIN_ALE, LOW); 90 | 91 | digitalWrite(PIN_MEMW, LOW); 92 | //delayMicroseconds(10); 93 | 94 | while (!digitalRead(PIN_IOCHRDY)) 95 | { 96 | } 97 | 98 | digitalWrite(PIN_MEMW, HIGH); 99 | //delayMicroseconds(10); 100 | 101 | DDR_DATA = 0x00; 102 | } 103 | 104 | uint8_t memRead(uint32_t address) 105 | { 106 | uint8_t data = 0x00; 107 | 108 | 109 | PORT_ADDR0 = address & 0xFF; 110 | PORT_ADDR8 = (address >> 8) & 0xFF; 111 | PORT_ADDR16 = (address >> 16) & 0xFF; 112 | 113 | //digitalWrite(PIN_ALE, HIGH); 114 | //digitalWrite(PIN_ALE, LOW); 115 | 116 | PORT_DATA = 0xFF; // pullup data bus 117 | DDR_DATA = 0x00; 118 | digitalWrite(PIN_MEMR, LOW); 119 | //delayMicroseconds(10); 120 | 121 | while (!digitalRead(PIN_IOCHRDY)) 122 | { 123 | } 124 | 125 | data = PIN_DATA; 126 | 127 | digitalWrite(PIN_MEMR, HIGH); 128 | //delayMicroseconds(10); 129 | 130 | return data; 131 | } 132 | 133 | void ioIndexedWrite(uint32_t address, uint16_t data) 134 | { 135 | ioWrite(address, data & 0xFF); 136 | ioWrite(address + 1, (data >> 8) & 0xFF); 137 | } 138 | uint8_t ioIndexedRead(uint32_t address, uint8_t index) 139 | { 140 | ioWrite(address, index); 141 | return ioRead(address + 1); 142 | } 143 | /*void ioIndexedWrite(uint32_t address, uint8_t index, uint8_t data) 144 | { 145 | ioWrite(address, index); 146 | ioWrite(address + 1, data); 147 | } 148 | uint8_t ioIndexedRead(uint32_t address, uint8_t index) 149 | { 150 | ioWrite(address, index); 151 | return ioRead(address + 1); 152 | }*/ 153 | 154 | void refreshInterrupt() 155 | { 156 | while (!digitalRead(PIN_REFRESH)) {} 157 | } 158 | 159 | void setup() 160 | { 161 | Serial.begin(1000000); 162 | 163 | PORT_ADDR0 = 0x00; 164 | PORT_ADDR8 = 0x00; 165 | PORT_ADDR16 = 0x00; 166 | 167 | DDR_ADDR0 = 0xFF; // [A0:A7] 168 | DDR_ADDR8 = 0xFF; // [A8:A15] 169 | DDR_ADDR16 = 0xFF; // [A16:A19] 170 | 171 | digitalWrite(PIN_MEMW, HIGH); 172 | digitalWrite(PIN_MEMR, HIGH); 173 | digitalWrite(PIN_IOW, HIGH); 174 | digitalWrite(PIN_IOR, HIGH); 175 | digitalWrite(PIN_REFRESH, HIGH); 176 | 177 | digitalWrite(PIN_AEN, LOW); 178 | digitalWrite(PIN_ALE, HIGH); 179 | 180 | digitalWrite(PIN_IOCHRDY, HIGH); // Pull-UP 181 | 182 | pinMode(PIN_MEMW, OUTPUT); 183 | pinMode(PIN_MEMR, OUTPUT); 184 | pinMode(PIN_IOW, OUTPUT); 185 | pinMode(PIN_IOR, OUTPUT); 186 | pinMode(PIN_REFRESH, INPUT_PULLUP); 187 | attachInterrupt(digitalPinToInterrupt(PIN_REFRESH), refreshInterrupt, FALLING); 188 | 189 | pinMode(PIN_ALE, OUTPUT); 190 | pinMode(PIN_AEN, OUTPUT); 191 | 192 | digitalWrite(PIN_RESET, HIGH); 193 | pinMode(PIN_RESET, OUTPUT); 194 | 195 | delay(100); 196 | digitalWrite(PIN_RESET, LOW); 197 | delay(1000); 198 | 199 | PORT_ADDR0 = 0x00; 200 | PORT_ADDR8 = 0x00; 201 | PORT_ADDR16 = 0x00; 202 | 203 | DDR_ADDR0 = 0xFF; // [A0:A7] 204 | DDR_ADDR8 = 0xFF; // [A8:A15] 205 | DDR_ADDR16 = 0xFF; // [A16:A19] 206 | 207 | Serial.print("R"); 208 | Serial.print('\n'); 209 | } 210 | 211 | uint8_t command; 212 | uint32_t address; 213 | uint8_t data; 214 | 215 | void loop() 216 | { 217 | if (Serial.available()) 218 | { 219 | command = Serial.read(); 220 | if (command == 'i') 221 | { 222 | while (Serial.available() < 2) {} 223 | address = (Serial.read() << 8); 224 | address |= Serial.read(); 225 | Serial.write(ioRead(address)); 226 | } 227 | 228 | if (command == 'o') 229 | { 230 | while (Serial.available() < 3) {} 231 | address = (Serial.read() << 8); 232 | address |= Serial.read(); 233 | data = Serial.read(); 234 | 235 | ioWrite(address, data); 236 | Serial.write('o'); 237 | } 238 | 239 | if (command == 'r') 240 | { 241 | while (Serial.available() < 3) {} 242 | address = ((uint32_t) Serial.read() << 16UL); 243 | address |= (Serial.read() << 8); 244 | address |= Serial.read(); 245 | Serial.write(memRead(address)); 246 | } 247 | 248 | if (command == 'w') 249 | { 250 | while (Serial.available() < 4) {} 251 | address = ((uint32_t)Serial.read() << 16UL); 252 | address |= (Serial.read() << 8); 253 | address |= Serial.read(); 254 | data = Serial.read(); 255 | 256 | memWrite(address, data); 257 | Serial.write('w'); 258 | } 259 | } 260 | //digitalWrite(PIN_REFRESH, 0); 261 | //delayMicroseconds(15); 262 | //digitalWrite(PIN_REFRESH, 1); 263 | } -------------------------------------------------------------------------------- /Utilities.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define PIN_MEMW 21 4 | #define PIN_MEMR 20 5 | #define PIN_IOW 19 6 | #define PIN_IOR 18 7 | 8 | #define PIN_RESET 17 9 | #define PIN_AEN 16 10 | #define PIN_ALE 15 11 | #define PIN_IOCHRDY 14 12 | 13 | #define PORT_ADDR0 PORTA // [A0:A7] 14 | #define PORT_ADDR8 PORTC // [A8:A15] 15 | #define PORT_ADDR16 PORTL // [A16:A19] 16 | #define PORT_DATA PORTK 17 | #define PIN_DATA PINK 18 | 19 | #define DDR_ADDR0 DDRA 20 | #define DDR_ADDR8 DDRC 21 | #define DDR_ADDR16 DDRL 22 | #define DDR_DATA DDRK 23 | 24 | void ioWrite(uint32_t address, uint8_t data) 25 | { 26 | PORT_ADDR0 = address & 0xFF; 27 | PORT_ADDR8 = (address >> 8) & 0xFF; 28 | PORT_ADDR16 = (address >> 16) & 0xFF; 29 | 30 | PORT_DATA = data; 31 | DDR_DATA = 0xFF; 32 | 33 | digitalWrite(PIN_IOW, LOW); 34 | delay(1); 35 | 36 | while (!digitalRead(PIN_IOCHRDY)) 37 | { 38 | } 39 | 40 | digitalWrite(PIN_IOW, HIGH); 41 | delay(1); 42 | 43 | DDR_DATA = 0x00; 44 | } 45 | 46 | uint8_t ioRead(uint32_t address) 47 | { 48 | uint8_t data = 0x00; 49 | 50 | PORT_ADDR0 = address & 0xFF; 51 | PORT_ADDR8 = (address >> 8) & 0xFF; 52 | PORT_ADDR16 = (address >> 16) & 0xFF; 53 | 54 | digitalWrite(PIN_ALE, HIGH); 55 | digitalWrite(PIN_ALE, LOW); 56 | 57 | PORT_DATA = 0xFF; // pullup data bus 58 | DDR_DATA = 0x00; 59 | digitalWrite(PIN_IOR, LOW); 60 | delay(1); 61 | 62 | while (!digitalRead(PIN_IOCHRDY)) 63 | { 64 | } 65 | 66 | data = PIN_DATA; 67 | 68 | digitalWrite(PIN_IOR, HIGH); 69 | delay(1); 70 | 71 | return data; 72 | } 73 | 74 | void memWrite(uint32_t address, uint8_t data) 75 | { 76 | PORT_ADDR0 = address & 0xFF; 77 | PORT_ADDR8 = (address >> 8) & 0xFF; 78 | PORT_ADDR16 = (address >> 16) & 0xFF; 79 | 80 | digitalWrite(PIN_ALE, HIGH); 81 | digitalWrite(PIN_ALE, LOW); 82 | 83 | PORT_DATA = data; 84 | DDR_DATA = 0xFF; 85 | 86 | digitalWrite(PIN_MEMR, LOW); 87 | delayMicroseconds(10); 88 | 89 | while (!digitalRead(PIN_IOCHRDY)) 90 | { 91 | } 92 | 93 | digitalWrite(PIN_MEMR, HIGH); 94 | delayMicroseconds(10); 95 | 96 | DDR_DATA = 0x00; 97 | } 98 | 99 | uint8_t memRead(uint32_t address) 100 | { 101 | uint8_t data = 0x00; 102 | 103 | digitalWrite(PIN_ALE, HIGH); 104 | 105 | PORT_ADDR0 = address & 0xFF; 106 | PORT_ADDR8 = (address >> 8) & 0xFF; 107 | PORT_ADDR16 = (address >> 16) & 0xFF; 108 | 109 | digitalWrite(PIN_ALE, LOW); 110 | 111 | PORT_DATA = 0xFF; // pullup data bus 112 | DDR_DATA = 0x00; 113 | digitalWrite(PIN_MEMR, LOW); 114 | delayMicroseconds(10); 115 | 116 | while (!digitalRead(PIN_IOCHRDY)) 117 | { 118 | } 119 | 120 | data = PIN_DATA; 121 | 122 | digitalWrite(PIN_MEMR, HIGH); 123 | delayMicroseconds(10); 124 | 125 | return data; 126 | } 127 | 128 | void ioIndexedWrite(uint32_t address, uint8_t index, uint8_t data) 129 | { 130 | ioWrite(address, index); 131 | ioWrite(address + 1, data); 132 | } 133 | uint8_t ioIndexedRead(uint32_t address, uint8_t index) 134 | { 135 | ioWrite(address, index); 136 | return ioRead(address + 1); 137 | } 138 | 139 | 140 | void setup() 141 | { 142 | Serial.begin(115200); 143 | 144 | PORT_ADDR0 = 0x00; 145 | PORT_ADDR8 = 0x00; 146 | PORT_ADDR16 = 0x00; 147 | 148 | DDR_ADDR0 = 0xFF; // [A0:A7] 149 | DDR_ADDR8 = 0xFF; // [A8:A15] 150 | DDR_ADDR16 = 0xFF; // [A16:A19] 151 | 152 | digitalWrite(PIN_MEMW, HIGH); 153 | digitalWrite(PIN_MEMR, HIGH); 154 | digitalWrite(PIN_IOW, HIGH); 155 | digitalWrite(PIN_IOR, HIGH); 156 | 157 | digitalWrite(PIN_RESET, HIGH); 158 | digitalWrite(PIN_ALE, LOW); 159 | digitalWrite(PIN_AEN, LOW); 160 | 161 | digitalWrite(PIN_IOCHRDY, HIGH); // Pull-UP 162 | 163 | pinMode(PIN_MEMW, OUTPUT); 164 | pinMode(PIN_MEMR, OUTPUT); 165 | pinMode(PIN_IOW, OUTPUT); 166 | pinMode(PIN_IOR, OUTPUT); 167 | 168 | pinMode(PIN_RESET, OUTPUT); 169 | pinMode(PIN_ALE, OUTPUT); 170 | pinMode(PIN_AEN, OUTPUT); 171 | 172 | delay(100); 173 | digitalWrite(PIN_RESET, LOW); 174 | delay(1000); 175 | 176 | // Serial.print("R"); 177 | // Serial.print('\n'); 178 | 179 | 180 | 181 | 182 | PORT_ADDR0 = 0x00; 183 | PORT_ADDR8 = 0x00; 184 | PORT_ADDR16 = 0x00; 185 | 186 | DDR_ADDR0 = 0xFF; // [A0:A7] 187 | DDR_ADDR8 = 0xFF; // [A8:A15] 188 | DDR_ADDR16 = 0xFF; // [A16:A19] 189 | } 190 | 191 | char textBuf[32]; 192 | 193 | String command; 194 | String address; 195 | String data; 196 | 197 | uint16_t currentPin = 0; 198 | 199 | void loop() 200 | { 201 | 202 | // Serial.println("IO Space:"); 203 | for (uint32_t i = 0x03A0UL; i < 0x03F0UL; i++) 204 | { 205 | /*if (i % 16 == 0) 206 | { 207 | Serial.println(); 208 | 209 | snprintf(textBuf, 31, "%08lx", i); 210 | Serial.print("Address: 0x"); 211 | Serial.print(textBuf); 212 | Serial.print(": "); 213 | }*/ 214 | 215 | //Serial.print(ioRead(i)); 216 | 217 | //snprintf(textBuf, 31, "%02x", ioRead(i)); 218 | //Serial.print(textBuf); 219 | } 220 | 221 | 222 | 223 | // Serial.println(); 224 | 225 | // Serial.println("Memory Space from 0xA0000:"); 226 | for (uint32_t i = 0xC0000UL; i < 0xC8000UL; i++) 227 | { 228 | Serial.write(memRead(i)); 229 | } 230 | while (1){} 231 | 232 | /*if (i % 16 == 0) 233 | { 234 | Serial.println(); 235 | 236 | snprintf(textBuf, 31, "%08lx", i); 237 | Serial.print("Address: 0x"); 238 | Serial.print(textBuf); 239 | Serial.print(": "); 240 | } 241 | 242 | snprintf(textBuf, 31, "%02x", memRead(i)); 243 | Serial.print(textBuf);*/ 244 | } 245 | 246 | 247 | /* 248 | if (Serial.available()) 249 | { 250 | uint8_t data = Serial.read(); 251 | if (data == '+') 252 | { 253 | currentPin++; 254 | //Serial.print('+\n'); 255 | } 256 | 257 | if (data == '-') 258 | { 259 | currentPin--; 260 | //Serial.print("-\n"); 261 | } 262 | 263 | Serial.print("Leitung D"); 264 | Serial.print(currentPin); 265 | Serial.println(); 266 | 267 | uint32_t address = (1UL << currentPin); 268 | PORT_DATA = address & 0xFF; 269 | 270 | sprintf(textBuf,"data: %02X\n", PORT_DATA); 271 | Serial.println(textBuf); 272 | } 273 | */ 274 | 275 | 276 | /* command = Serial.readStringUntil('\n'); 277 | if (command.length() != 0) 278 | { 279 | if (command[0] == 'i') 280 | { 281 | address = command.substring(1, 5); 282 | Serial.print("i"); 283 | Serial.print(ioRead((int) strtol( &address[0], NULL, 16)), HEX); 284 | Serial.print('\n'); 285 | } 286 | 287 | if (command[0] == 'o') 288 | { 289 | address = command.substring(1, 5); 290 | data = command.substring(5, 7); 291 | 292 | ioWrite((int) strtol( &address[0], NULL, 16), (int) strtol( &data[0], NULL, 16)); 293 | 294 | Serial.print("o\n"); 295 | } 296 | }*/ 297 | 298 | } --------------------------------------------------------------------------------