gregwinn / arduino-tvout

Automatically exported from code.google.com/p/arduino-tvout
0 stars 0 forks source link

Problem when combining TVout library and PS2Keyboard library #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
set up TVout, this step works, I am able to run the examples, and they work fine
2.
Set up PS2keyboard library, this works, I ran teh example and it works fine.
3.
Mix TVout and PS2Keyboard, when I did this, I got problems.
 I went ahead and combined TVout and PS2Keyboard libraries, but they seem to clash with each other, they work,  but weird things happen  on the TV   there is a glitch whenever I press a key, and on the keyboard there is sometimes wrong keystrokes detected... they both work well indivisually here is my combined code http://pastebin.com/caVhZQcT

What is the expected output? What do you see instead?
each key I type on the keyboard should just appear on the screen,  but instead 
sometimes wrong characters appear. and also there is a glitch on the TV 
everytime I press a key.    also, since I am logging everything to the serial 
port, I can see that the PS2Keyboard library is failing to recognize the 
characters when mixed with TVout.

What version of the product are you using? On what operating system?

I am using TVoutBeta1 uploaded to arduino uno  from a windows computer

Please provide any additional information below.

 I went ahead and combined TVout and PS2Keyboard libraries, but they seem to clash with each other, they work,  but weird things happen  on the TV   there is a glitch whenever I press a key, and on the keyboard there is sometimes wrong keystrokes detected... they both work well indivisually here is my combined code http://pastebin.com/caVhZQcT

Original issue reported on code.google.com by usmpa...@gmail.com on 20 Sep 2011 at 5:21

GoogleCodeExporter commented 9 years ago
I tried stopping timers when a key is pressed, and enabling them after it was 
released. but still the input is currupted, I wouldnt really care much if there 
is a minor glitch in video temprarily, but I want to be able to get information 
from the keyboard. here is the code I tried in the PS2Keyboard library:

void ps2interrupt(void)
{
    //stop interrupts 
    cli();

    static uint8_t bitcount=0;
    static uint8_t incoming=0;
    static uint32_t prev_ms=0;
    uint32_t now_ms;
    uint8_t n, val;

    val = digitalRead(PollPS2_DataPin);
    now_ms = millis();
    if (now_ms - prev_ms > 250) {
        bitcount = 0;
        incoming = 0;
    }
    prev_ms = now_ms;
    n = bitcount - 1;
    if (n <= 7) {
        incoming |= (val << n);
    }
    bitcount++;
    if (bitcount == 11) {
        uint8_t i = head + 1;
        if (i >= BUFFER_SIZE) i = 0;
        if (i != tail) {
            buffer[i] = incoming;
            head = i;
        }
        bitcount = 0;
        incoming = 0;
    }
    //start interrupts
    sei();
}

Original comment by usmpa...@gmail.com on 20 Sep 2011 at 1:51

GoogleCodeExporter commented 9 years ago
Hello, 

I am using both the libraries and my sketch seams to work correctly.

The only issue I found is the glitch when pressing a key.
I've also observed than pressing continuously a key, the glitching phenomenon 
disappears.

I don't know if it's your case, but few days ago in one of mine sketches, the 
PS2 Keyboard library didn't recognize correctly a key due to the too high 
memory allocation (using a matrix)...
I hope this could be helpful... 

Now I will try to solve the glitching issue...

Original comment by simone.p...@gmail.com on 9 Dec 2011 at 2:16

GoogleCodeExporter commented 9 years ago
I have already found a fix to the problem.  It was to use pollserial to get 
data from the keyboard. It works perfectly.  I can send you the libraries and 
sketch if you want

Original comment by usmpa...@gmail.com on 11 Dec 2011 at 1:10

GoogleCodeExporter commented 9 years ago
Ok! If you send me libraries and sketch I will appreciate! 

Original comment by simone.p...@gmail.com on 11 Dec 2011 at 5:25

GoogleCodeExporter commented 9 years ago
Ok, here is the library on the attached files

alos, I thought you might be interested in the BASIC interpreter for
arduino I made
https://github.com/amigojapan/Interactive-Arduino-Basic-Interpreter
 I will eventually figure out a way to do something to get enbough ram to
run both the BASIC intepreter AND all TV out at the same time to make a
retro computer, I think I may store the programs in progmem

also you might want to add as an example of TV out my video of this True
Serial Terminal I made that actually connects to a linux computer and can
control it thru a serial port. it is the latest video of my channel
http://youtube.com/amigojapan

Original comment by usmpa...@gmail.com on 12 Dec 2011 at 1:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thank you! I am just trying your Basic Interpreter!

I'm sorry but I can't see your attachment... :( 

Original comment by simone.p...@gmail.com on 12 Dec 2011 at 5:39

GoogleCodeExporter commented 9 years ago
Ok, later when I get time I will upload it to github and send you the link or 
something 

Original comment by usmpa...@gmail.com on 13 Dec 2011 at 5:28

GoogleCodeExporter commented 9 years ago
OK, try downloading it from here please
http://www.mediafire.com/?ru7562sifbl204q

Original comment by usmpa...@gmail.com on 13 Dec 2011 at 9:16

GoogleCodeExporter commented 9 years ago
Received! 

I will try it later and let you know!

Thank you!

Original comment by simone.p...@gmail.com on 13 Dec 2011 at 12:26

GoogleCodeExporter commented 9 years ago
Everything working!

Thank you again!

Original comment by simone.p...@gmail.com on 15 Dec 2011 at 12:40

GoogleCodeExporter commented 9 years ago
Great!

Original comment by usmpa...@gmail.com on 16 Dec 2011 at 2:27

GoogleCodeExporter commented 9 years ago
Hi, I have another question. The ore Beta 1.0 version of TV out seemed to have 
a pause() function which "returns full CPU power". Is there an equivalent in 
the new versions?

On 2011/12/15, at 21:41, arduino-tvout@googlecode.com wrote:

Original comment by usmpa...@gmail.com on 30 Apr 2012 at 4:23

GoogleCodeExporter commented 9 years ago
does anyone have the attachment since the op was kind enough to place it on a 
crap server which no longer has the file?

Thanks

Original comment by ke...@hackaday.com on 31 Dec 2012 at 9:18

GoogleCodeExporter commented 9 years ago
I have it on my home computer but I won't have access to it for a week or so

Original comment by usmpa...@gmail.com on 31 Dec 2012 at 11:40

GoogleCodeExporter commented 9 years ago
Thats fine if you can repost it when you get back

Thanks

Original comment by ke...@hackaday.com on 2 Jan 2013 at 6:21

GoogleCodeExporter commented 9 years ago
OK, I have heard some people on the mailing list asking about the library to 
use PS2keyboard together with TVout, here is a link to it 
https://github.com/amigojapan/Arduino_TVout_with_ps2Keyboard/blob/master/ps2uart
Keyboard.zip?raw=true

Original comment by usmpa...@gmail.com on 10 Jan 2013 at 8:24

GoogleCodeExporter commented 9 years ago
Thank you very much!

Original comment by ke...@hackaday.com on 13 Jan 2013 at 12:29

GoogleCodeExporter commented 9 years ago
No problem :)

Original comment by usmpa...@gmail.com on 13 Jan 2013 at 4:48