Chri O. Posted May 4, 2022 Share Posted May 4, 2022 Perhaps this will help. Pin location on 1050 motherboard: Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 Pic. at U2 & U3. Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 5 hours ago, TGB1718 said: I've not used a Teensy, they seem to be a bit pricey, what frequency does the core runs at, just in case I get some timing issues with the Pico. All Teensy boards are assembled (soldered), tested & packaged in Oregon, USA. $$$ ? Teensy 4.0 frequency running @ 600Mhz this is what I had available and it's complete OverKill ? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 4, 2022 Share Posted May 4, 2022 1 minute ago, Chri O. said: All Teensy boards are assembled (soldered), tested & packaged in Oregon, USA. $$$ ? Teensy 4.0 frequency running @ 600Mhz this is what I had available and it's complete OverKill ? Pico is running at 125MHz, that's why I thought I may have some timing issues as it's somewhat quicker, I was going to use it's dual core for the interrupts, but that might make it a bit too fast Is the Teensy 5V tolerant ? I know the Pico I'm using isn't, so will have to add some voltage shifters or a resistor network to limit to 3.3V. Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 3 minutes ago, TGB1718 said: Is the Teensy 5V tolerant ? NO only 3.3v MAX 4 minutes ago, TGB1718 said: I know the Pico I'm using isn't, so will have to add some voltage shifters or a resistor network to limit to 3.3V. Included in the schematics ( Voltage Divider 5v - 3.3 ) Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 4, 2022 Share Posted May 4, 2022 2 minutes ago, Chri O. said: NO only 3.3v MAX Included in the schematics ( Voltage Divider 5v - 3.3 ) OOPS!!! need new glasses, unfortunately, I was focusing on the connections that for some reason are not being displayed on your original diagram, even when zoomed, some connections are not there. Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 12 minutes ago, TGB1718 said: I was focusing on the connections that for some reason are not being displayed on your original diagram Interesting ? Maybe it's because of the 4k monitor I am using ? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 4, 2022 Share Posted May 4, 2022 Maybe, that latest shot is fine Quote Link to comment Share on other sites More sharing options...
xrbrevin Posted May 4, 2022 Share Posted May 4, 2022 nicely done! ? what behaviour did you observe on the scope at pins 2 and 7 of U2 and U3 during step in and step out operations? am i right in thinking that you use the PWM pins on the teensy to detect a rising state on pin 7 (interrupt) and based on the state of pin 2 (high or low), determines step +1 or -1? i wonder if this could be translated to work using a small arduino? teensy4 does seem overkill.. Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 10 minutes ago, xrbrevin said: am i right in thinking that you use the PWM pins on the teensy to detect a rising state All pins on teensy 4.0 are interrupt capable. Two (NS02 & NS04) edge-triggered interrupt on RISING edge (low to high) while inside the interrupt I read the digital voltage on pin NS01 or NS03 respectively. void IRQ_NS02() { if (digitalReadFast(interruptPin_NS01) == HIGH) { Tcount ++; } else { Tcount --; } //Serial.print("T NS02 :"); // debug print //Serial.println(Tcount); // debug print } void IRQ_NS04() { if (digitalReadFast(interruptPin_NS03) == HIGH) { Tcount ++; } else { Tcount --; } //Serial.print("T NS04 :"); // debug print //Serial.println(Tcount); // debug print } By the way the serial debug printing inside the interrupts supposed to be disabled ? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 4, 2022 Share Posted May 4, 2022 Strangely, although I can display the initial messages, the actual track numbers do not show on the display, maybe it's because I'm using an Adafruit_SSD1306 but I would have expected something, I had to modify the code slightly and this worked. Also doing it this way, don't need the test for NewTcount < 10 Added:- char buff[3]; and modified the print to display:- if (OldTcount != NewTcount) OldTcount = NewTcount; display.clearDisplay(); display.setCursor(12, 0); sprintf(buff,"%02d",NewTcount); display.print(buff); display.display(); For testing, I added some debug routines and it counts up and down fine and track 0 high resets the counter 1 Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 Feel free to hack or edit the code the way you want license MIT you could go commercial with this and make this project close source. haha? Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 4, 2022 Share Posted May 4, 2022 (edited) 51 minutes ago, xrbrevin said: i wonder if this could be translated to work using a small arduino? teensy4 does seem overkill.. I don't think there is any problems other than moving few NS0x pins around (Digital Pins Usable For Interrupts 2, 3). Of course I am thinking about the good old Arduino Uno ATmega328 8-bit AVR Microcontrollers unless you go AVR programming C style Pin Change Interrupts. Edited May 4, 2022 by Chri O. 1 Quote Link to comment Share on other sites More sharing options...
xrbrevin Posted May 4, 2022 Share Posted May 4, 2022 23 minutes ago, Chri O. said: I don't think there is any problems other than moving few NS0x pins around (Digital Pins Usable For Interrupts 2, 3). Of course I am thinking about the good old Arduino Uno ATmega328 8-bit AVR Microcontrollers unless you go AVR programming C style Pin Change Interrupts. looks feasible, ill give it a go but ive had to order an OLED display so i can't proceed just yet do you know if i could use one of those smaller 128x32 displays? - the sort used on gotek drives. i think it would be easier to accommodate on the 1050 fascia Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 4, 2022 Share Posted May 4, 2022 1 hour ago, xrbrevin said: do you know if i could use one of those smaller 128x32 displays? - That's what I've used, have to change the code a little for example:- #include <Adafruit_SSD1306.h> // OLED 0.91" // Adafruit_SH1106 display(OLED_RESET); <<< change this, for the line below Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); Then a bit of playing with text positions & the code snippet used in my post #61 above. 1 1 Quote Link to comment Share on other sites More sharing options...
macsonny Posted May 8, 2022 Author Share Posted May 8, 2022 On 5/4/2022 at 11:44 AM, Chri O. said: Note: This sketch was tested on Teensy 4.0 /********************************************************************* MIT License Copyright (c) [2022] [Chris O.] Atari 1050 - Track Display, ver 01. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *********************************************************************/ // https://github.com/wonho-maker/Adafruit_SH1106 /********************************************************************* Change the adafruit SSD1306 to SH1106 SH1106 driver don't provide several functions such as scroll commands. *********************************************************************/ // Teensy SH1106 driver fix https://forum.pjrc.com/threads/68174-OLED-problems const byte VER = 1; const byte interruptPin_NS01 = 2; // NS01 @ U2 ic pin 2, NOT USED FOR interrupt. const byte interruptPin_NS02 = 3; // NS02 @ U2 ic pin 7 const byte interruptPin_NS03 = 4; // NS03 @ U3 ic pin 2 NOT USED FOR interrupt. const byte interruptPin_NS04 = 5; // NS04 @ U3 ic pin 7 const byte N_TRACK00_Pin = 6; // Q5 @ R#59 Track 00 sensor. volatile byte Tcount = 0; byte NewTcount = Tcount; byte OldTcount = Tcount; #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SH1106.h> // OLED 1.30" @ I2C addr. 0x3C #define OLED_RESET -1 // -1, NO RESET Adafruit_SH1106 display(OLED_RESET); #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 }; void setup() { Serial.begin(9600); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) display.begin(SH1106_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64), SH1106 addr 0x3C. // init done // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.display(); delay(1000); // Clear the buffer. display.clearDisplay(); // Show the display buffer on the hardware. // NOTE: You _must_ call display after making any drawing commands // to make them visible on the display hardware! display.display(); Serial.println("Basic 1050 Track Display Test:"); display.setTextSize(2); // display.setTextColor(WHITE); display.setTextColor(BLACK, WHITE); // 'inverted' text display.setCursor(0, 5); display.println("Atari 1050"); // display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(10, 30); display.println("Track Display Test"); // display.setCursor(10, 55); display.print("V.0"); display.println(VER); display.display(); // display setup for loop() display.clearDisplay(); display.setCursor(5, 5); display.setTextSize(9); pinMode(N_TRACK00_Pin, INPUT_PULLUP); pinMode(interruptPin_NS01, INPUT_PULLUP); pinMode(interruptPin_NS02, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(interruptPin_NS02), IRQ_NS02, RISING); //RISING, CHANGE, FALLING pinMode(interruptPin_NS03, INPUT_PULLUP); pinMode(interruptPin_NS04, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(interruptPin_NS04), IRQ_NS04, RISING); //RISING, CHANGE, FALLING } void loop() { noInterrupts(); NewTcount = Tcount; interrupts(); if (digitalReadFast(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; } if (OldTcount != NewTcount) { OldTcount = NewTcount; display.clearDisplay(); display.setCursor(10, 4); if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); display.display(); } } void IRQ_NS02() { if (digitalReadFast(interruptPin_NS01) == HIGH) { Tcount ++; } else { Tcount --; } Serial.print("T NS02 :"); // debug print Serial.println(Tcount); // debug print } void IRQ_NS04() { if (digitalReadFast(interruptPin_NS03) == HIGH) { Tcount ++; } else { Tcount --; } Serial.print("T NS04 :"); // debug print Serial.println(Tcount); // debug print } TODO: draw schematics. EDIT: For some reason I can't figure out why I can't edit the code in Code tag ? Anyways in void loop() change: if (digitalReadFast(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; } to: if (digitalReadFast(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; noInterrupts(); Tcount = 0; interrupts(); } I've loaded this script up into Teensyduino and tried to compile. Initially I got a few errors that they were quickly resolved by ensuring I had the libraries installed. However, I can't get pst the line "if (digitalReadFast(interruptPin_NS03) == HIGH) {" with error 'digitalReadFast' was not declared in this scope. I tried to install a library "digitalReadFast" but there isn't one. Which library to I need to install? Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 8, 2022 Share Posted May 8, 2022 (edited) digitalReadFast is a 'native' or core function included in the Teensy build process, it is not an external or separate library. All the libraries are put in place after the IDE is installed then Running the TeensyDuino installer. To be honest you can switch it to: if (digitalRead(N_TRACK00_Pin) == HIGH) Edited May 8, 2022 by Chri O. Quote Link to comment Share on other sites More sharing options...
macsonny Posted May 8, 2022 Author Share Posted May 8, 2022 13 minutes ago, Chri O. said: digitalReadFast is a 'native' or core function included in the Teensy build process, it is not an external or separate library. All the libraries are put in place after the IDE is installed then Running the TeensyDuino installer. To be honest you can switch it to: if (digitalRead(N_TRACK00_Pin) == HIGH) Found the issue. I didn't have the software initialised as a Tiny 4.0 board. All good now. Quote Link to comment Share on other sites More sharing options...
macsonny Posted May 8, 2022 Author Share Posted May 8, 2022 Ok. The good news is that I got the display working and every plugged up. Bad news is that when the drive boots "00" track is displayed, it tries to jump to next number with track for a moment and then goes back to "00". I've attached both my code. IMG_7578.mov Any ideas? /********************************************************************* MIT License Copyright (c) [2022] [Chris O.] Atari 1050 - Track Display, ver 01. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *********************************************************************/ // https://github.com/wonho-maker/Adafruit_SH1106 /********************************************************************* Change the adafruit SSD1306 to SH1106 SH1106 driver don't provide several functions such as scroll commands. *********************************************************************/ // Teensy SH1106 driver fix https://forum.pjrc.com/threads/68174-OLED-problems const byte VER = 1; char buff[3]; const byte interruptPin_NS01 = 2; // NS01 @ U2 ic pin 2, NOT USED FOR interrupt. const byte interruptPin_NS02 = 3; // NS02 @ U2 ic pin 7 const byte interruptPin_NS03 = 4; // NS03 @ U3 ic pin 2 NOT USED FOR interrupt. const byte interruptPin_NS04 = 5; // NS04 @ U3 ic pin 7 const byte N_TRACK00_Pin = 6; // Q5 @ R#59 Track 00 sensor. volatile byte Tcount = 0; byte NewTcount = Tcount; byte OldTcount = Tcount; #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // OLED 1.30" @ I2C addr. 0x3C #define OLED_RESET -1 // -1, NO RESET //Adafruit_SSD1306 display(OLED_RESET); Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET); #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 }; void setup() { Serial.begin(9600); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64), SH1106 addr 0x3C. // init done // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.display(); delay(1000); // Clear the buffer. display.clearDisplay(); // Show the display buffer on the hardware. // NOTE: You _must_ call display after making any drawing commands // to make them visible on the display hardware! display.display(); Serial.println("Basic 1050 Track Display Test:"); display.setTextSize(2); // display.setTextColor(WHITE); display.setTextColor(BLACK, WHITE); // 'inverted' text display.setCursor(0, 5); display.println("Atari 1050"); // display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(10, 30); display.println("Track Display Test"); // display.setCursor(10, 55); display.print("V.0"); display.println(VER); display.display(); // display setup for loop() display.clearDisplay(); display.setCursor(5, 5); display.setTextSize(9); pinMode(N_TRACK00_Pin, INPUT_PULLUP); pinMode(interruptPin_NS01, INPUT_PULLUP); pinMode(interruptPin_NS02, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(interruptPin_NS02), IRQ_NS02, RISING); //RISING, CHANGE, FALLING pinMode(interruptPin_NS03, INPUT_PULLUP); pinMode(interruptPin_NS04, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(interruptPin_NS04), IRQ_NS04, RISING); //RISING, CHANGE, FALLING } void loop() { noInterrupts(); NewTcount = Tcount; interrupts(); if (digitalReadFast(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; noInterrupts(); Tcount = 0; interrupts(); } if (OldTcount != NewTcount) { OldTcount = NewTcount; display.clearDisplay(); display.setCursor(12, 0); sprintf(buff,"%02d",NewTcount); display.print(buff); display.display(); //if (NewTcount < 10) { //display.print("0"); //} //display.print(NewTcount); //display.display(); } } void IRQ_NS02() { if (digitalReadFast(interruptPin_NS01) == HIGH) { Tcount ++; } else { Tcount --; } //Serial.print("T NS02 :"); // debug print //Serial.println(Tcount); // debug print } void IRQ_NS04() { if (digitalReadFast(interruptPin_NS03) == HIGH) { Tcount ++; } else { Tcount --; } //Serial.print("T NS04 :"); // debug print //Serial.println(Tcount); // debug print } Quote Link to comment Share on other sites More sharing options...
macsonny Posted May 8, 2022 Author Share Posted May 8, 2022 Here's a video> Track counter does increase but quickly goes back to zero. IMG_7587.mov Quote Link to comment Share on other sites More sharing options...
guus.assmann Posted May 8, 2022 Share Posted May 8, 2022 Hello, Coundn't see the video. However, the drive does go to track zero, then steps in and steps out again. This is to test the track-zero sensor. So maybe you should try to give a format-command and see if the display shows that corectly. BR/ Guus Quote Link to comment Share on other sites More sharing options...
macsonny Posted May 8, 2022 Author Share Posted May 8, 2022 1 minute ago, guus.assmann said: Hello, Coundn't see the video. However, the drive does go to track zero, then steps in and steps out again. This is to test the track-zero sensor. So maybe you should try to give a format-command and see if the display shows that corectly. BR/ Guus Hi Guus, I tried that with no luck. I've rechecked the circuit 3 times now and rebuilt twice just to make sure I had no mistakes in the building. For some reason it just resets to zero every time it moves forward and I can see the tracks increase before going back to zero. I have also noticed that when I use DiskWizard II to go to specific sectors, the track number will actually change and stay on. For example, when I goto sector 720, the track display shows 24 - which isn't correct as I would have thought it should be showing 39? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 8, 2022 Share Posted May 8, 2022 (edited) What controller are you using ? It may be a timing issue i.e. too fast or too slow responding Unfortunately I've not had time to try mine in a 1050 which is using a Raspberry Pi Pico, I do anticipate some timing issues as it's a lot faster than the teensy. Edited May 8, 2022 by TGB1718 Quote Link to comment Share on other sites More sharing options...
Chri O. Posted May 8, 2022 Share Posted May 8, 2022 I've got this running on ESP8266 WeMos D1 mini thinking about going Wireless.? This time I did not use voltage divider but SN74HC245N ic and I remove this from Loop() if (digitalRead(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; // noInterrupts(); // Tcount = 0; // interrupts(); } Quote Link to comment Share on other sites More sharing options...
macsonny Posted May 8, 2022 Author Share Posted May 8, 2022 4 hours ago, Chri O. said: I've got this running on ESP8266 WeMos D1 mini thinking about going Wireless.? This time I did not use voltage divider but SN74HC245N ic and I remove this from Loop() if (digitalRead(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; // noInterrupts(); // Tcount = 0; // interrupts(); } I'm wondering if it has something to do with the configuration of the Teensy 4.0 I'm using? Do I need to set it up in some way to recognise the interrupts? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.