Robo_17
Robo_17
AArduino
Created by Robo_17 on 5/30/2025 in #coding-help
how to attachinterrupt()
Actually i want to just change the currentchar value to the next character in the string so ig i will just keep a track of the currentchar index in that string outside isr
10 replies
AArduino
Created by Robo_17 on 5/30/2025 in #coding-help
how to attachinterrupt()
hmn will test
10 replies
AArduino
Created by Robo_17 on 5/30/2025 in #coding-help
how to attachinterrupt()
note i replaced the pushbutton with a jumper wire and just make it high and low from +5V
10 replies
AArduino
Created by Robo_17 on 5/30/2025 in #coding-help
how to attachinterrupt()
int currentCursor[] = {0,0};
void setup() {
// put your setup code here, to run once:
pinMode(pushButton,INPUT_PULLUP);
pinMode(execute,INPUT);
// pinMode(enter,INPUT);
pinMode(alwayshigh,OUTPUT);
digitalWrite(alwayshigh,HIGH);
lcd.begin(16,2);
lcd.print("8085 Simulator");
delay(2000);
lcd.clear();
lcd.setCursor(6,0);
attachInterrupt(digitalPinToInterrupt(pushButton), changecharacter, RISING);
for(int i =0;i<=3;i++){
lcd.print(flags[i]);
}
lcd.setCursor(16,1);
currentCursor[0] = 16;
}

//The ISR of the pushbutton
void changecharacter(){
for(int i=0;i<=36;i++){
if (instructionChars[i] == currentCharacter){
currentCharacter = instructionChars[i];
break;
}
currentCursor[0] -= 1;
}
delay(500);
}
///////////////////////////////

//The ISR of the the execute
// void executefunction(){

// delay(100);
// }
//////////////////////////////////
//The ISR of enter
// void enter(){

// }
int blinkingCharacter(char character,int x,int y){
while(enterState == 0){
lcd.setCursor(x,y);
lcd.print(character);
delay(1000);
lcd.print(" ");
}
return 0;
}
void loop() {
// put your main code here, to run repeatedly:
// lcd.setCursor(0,1);
// lcd.print(millis()/1000);
// delay(100);
switch(state){
case 1:
blinkingCharacter(currentCharacter,currentCursor[0],currentCursor[1]);
}
}
int currentCursor[] = {0,0};
void setup() {
// put your setup code here, to run once:
pinMode(pushButton,INPUT_PULLUP);
pinMode(execute,INPUT);
// pinMode(enter,INPUT);
pinMode(alwayshigh,OUTPUT);
digitalWrite(alwayshigh,HIGH);
lcd.begin(16,2);
lcd.print("8085 Simulator");
delay(2000);
lcd.clear();
lcd.setCursor(6,0);
attachInterrupt(digitalPinToInterrupt(pushButton), changecharacter, RISING);
for(int i =0;i<=3;i++){
lcd.print(flags[i]);
}
lcd.setCursor(16,1);
currentCursor[0] = 16;
}

//The ISR of the pushbutton
void changecharacter(){
for(int i=0;i<=36;i++){
if (instructionChars[i] == currentCharacter){
currentCharacter = instructionChars[i];
break;
}
currentCursor[0] -= 1;
}
delay(500);
}
///////////////////////////////

//The ISR of the the execute
// void executefunction(){

// delay(100);
// }
//////////////////////////////////
//The ISR of enter
// void enter(){

// }
int blinkingCharacter(char character,int x,int y){
while(enterState == 0){
lcd.setCursor(x,y);
lcd.print(character);
delay(1000);
lcd.print(" ");
}
return 0;
}
void loop() {
// put your main code here, to run repeatedly:
// lcd.setCursor(0,1);
// lcd.print(millis()/1000);
// delay(100);
switch(state){
case 1:
blinkingCharacter(currentCharacter,currentCursor[0],currentCursor[1]);
}
}
10 replies
AArduino
Created by Robo_17 on 5/30/2025 in #coding-help
how to attachinterrupt()
#include <LiquidCrystal.h>
#include <string.h>
const int rs =12,en=11,d4=5,d5=4,d6=3,d7=2;
int A,B,C,D,E,H,L = 0x0;
//int S,Z,AC,Carry
int flags[4] = {0,0,0,0};
//memory array
int memory[60] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
//push button,execute,enter
int pushButton = 18;
int execute = 19;
//int enter = ;
///////////////////////////
int executeState = 0;
int enterState = 0;
//always high pin
int alwayshigh = 34;

//The array of states
int state = 1; //this is needed to take input from user using the push button
int states[2] = {0,1};//1=Write,0=Read

//the array for characters to take input
char instructionChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,";
char currentCharacter = 'A';
/////////////////////////////////////////////////////
#include <LiquidCrystal.h>
#include <string.h>
const int rs =12,en=11,d4=5,d5=4,d6=3,d7=2;
int A,B,C,D,E,H,L = 0x0;
//int S,Z,AC,Carry
int flags[4] = {0,0,0,0};
//memory array
int memory[60] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
//push button,execute,enter
int pushButton = 18;
int execute = 19;
//int enter = ;
///////////////////////////
int executeState = 0;
int enterState = 0;
//always high pin
int alwayshigh = 34;

//The array of states
int state = 1; //this is needed to take input from user using the push button
int states[2] = {0,1};//1=Write,0=Read

//the array for characters to take input
char instructionChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,";
char currentCharacter = 'A';
/////////////////////////////////////////////////////
10 replies