Page 7 of 17

Re: Hacking cartridge HP 84/85

Posted: Wed Oct 24, 2018 9:27 am
by MAsic12345
Wonko
can you write a code template?I tried and cannot combine
thank you

Re: Hacking cartridge HP 84/85

Posted: Wed Oct 24, 2018 12:48 pm
by dragonator
The outPin needs to stay. The PORTB stuff replaces the digital writes. Also try the code without the delays first to see the absolute maximum possible speed. I have commented a faster way (but more fragile) to delay. Uncomment this to add a 62ns delay. Pin 8 should now switch as fast as possible.

Did you have a teensy on your way? It has these problems a lot less and runs a faster. (and is 3.3V by default)

Code: Select all

int outPin = 8;                 // digital pin 8

void setup()
{
  pinMode(outPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  PORTB|=1;   // sets the pin on
   //__asm__("nop\n\t"); 
  PORTB&=~1;    // sets the pin off
  //__asm__("nop\n\t"); 
}

Re: Hacking cartridge HP 84/85

Posted: Fri Oct 26, 2018 8:46 am
by MAsic12345
did here what happened
port (b) for some reason does not work, perhaps I burned it

found ports from arduino mega
Mega Port Diagram.png
Mega Port Diagram.png (150.72 KiB) Viewed 11422 times
changed to port (a) and that's what happened
33.png
33.png (26.29 KiB) Viewed 11422 times
and the question arose why the second output gives some kind of signal if only one first is connected
viber image.jpg
viber image.jpg (219.33 KiB) Viewed 11422 times

Re: Hacking cartridge HP 84/85

Posted: Sat Oct 27, 2018 6:50 am
by MAsic12345
Wonko
Did you have a teensy on your way? It has these problems a lot less and runs a faster. (and is 3.3V by default)
teensy I do not have,
if you say that arduino will not repeat the desired signal then I will order teensy

Re: Hacking cartridge HP 84/85

Posted: Sat Oct 27, 2018 9:28 pm
by Wonko
Arduino Due has the same shape as the Mega and also a faster ARM based CPU and 3.3V.

I forgot to mention interrupts. To keep the serial port working and a few other things, Arduinos use interrupts that - as the name says - interrupts the flow of your program at any point in time. For the duration of time critical bit manipulation, you should probably disable all interrupts. But be careful, don't forget to switch them back on, because they are needed for generating some of the signals and for longer range timers:

https://www.arduino.cc/reference/en/lan ... nterrupts/

Re: Hacking cartridge HP 84/85

Posted: Fri Nov 02, 2018 4:00 pm
by MAsic12345
Finally i got an Teensy
I can't teach him to give a quick signal,
I used your Wonko code,
ports trick (A) (B) does not work
maybe the Teensy has no ports like the Arduino?
teensy.jpg
teensy.jpg (178.08 KiB) Viewed 11298 times

Re: Hacking cartridge HP 84/85

Posted: Fri Nov 02, 2018 5:03 pm
by dragonator
Teensy direct port manipulation requires different code.

Try it with Digital writes first. Teensy should even then be faster than Arduino with Port manipulation.

Re: Hacking cartridge HP 84/85

Posted: Fri Nov 02, 2018 5:46 pm
by MAsic12345
dragonator that's what happened

Re: Hacking cartridge HP 84/85

Posted: Fri Nov 02, 2018 6:05 pm
by dragonator
Are there any delays on here? It is slower than what I am used to.

I would need to look in some of my code to find Teensy port manipulation code.

Re: Hacking cartridge HP 84/85

Posted: Fri Nov 02, 2018 6:11 pm
by MAsic12345
dragonator delayed I did not set
I used the LED code and removed the delay