Anobium-
I have been trying to get composite b/w to work and can put bars on the screen from searching info from others using pic.
Lots of arduino examples that use "tvout" as include lib. No use to me as I can't convert the c to gcb.
I need to make a buffer and read it then send to display.
I thought of the ssd1306 and its buffer but looking at the gcb ssd1306.h include can not figure how to use the glcd graphics to just draw/print to the buffer then have access to it instead of it writing to the ssd1306.
The pic search says don't use interrupts because of latency whereas arduino tvout lib uses interrupts??
I'm using a 10"" lcd tv that's analogue rf so useless but it's got composite pal video in and apparently an lcd will tolerate poor sync signals so allowing for errors whereas using an old b/w crt tv would need better sync.
Not a priority but any thoughts?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The SSD1306 does use a RAM buffer. It is called SSD1306_BufferAlias()
You can access the buffer directly using SSD1306_BufferAlias(0..1023) or PixelStatus_SSD1306(GLCDX, GLCDY )
Where a byte in the array is a pixel representation of the 128x64 display. Where byte are stored using this calculation GLCDX +( GLCDY / 8 )* GLCD_WIDTH + 1. So, think of the pixels being X orientated per byte in the SSD1306_BufferAlias array.
Hope this helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium, am I right thinking the buffer holds what's been printed/drawn and that it's like a crt tv ie top row then next then next all following in the buffer array? Like zx and cpc464 and bbcmicro, just a block of screen memory.
I tried this to test and flashes but nothing in the terminal. I probably missed something but is this how to get info from the buffer please?
I will have to strip the ssd1306 to just do the buffer... not easy but it flashed without a ssd1306 connected.
You will see the following six (there are 1024 addresses shown in total) array addresses 1, 129,257,385,513,641. Yes.. every 128 because we scanning the array in this in the Y axis. And, you will see is reading the 8 bits from the array element byte. Why this seems odd - it is not. As this is the most optimal.
Proof - change the For-Next
forcounty=0to63forcountx=0to127
This will show the array elements being read in sequence 1-2-3-4 but it reading the same sequence 128 more times that the other method.
So, think of the array holding data as shown is the attachment. Where XY pixels are held in the array.
@Anobium, Thanks for taking the time to explain things, it's appreciated. I should have looked up my uno code for serprint to terminal.
The info I have is for a pic at 32MHz and the timing is important.
You get 57uS of visible line scan to shift the byte in a ram buffer and switch a port pin hi/lo.
It's the 2 port with a resistor in series with each pin joined and that's the composite video out.
1 pin is b/w video and the other is the horizontal and vertical sync.
Examples are pic asm and lots of nops to get the timing.
PixelStatus_SSD1306(GLCDX, GLCDY ) takes probably longer than reading a byte from the buffer array and getting the bit. You don't get much time to do much so anything using multiplication would take too long... maybe. I'll check all options. A 16MHz Uno is twice as fast as a 32MHz pic... yes?
The idea is using just a ucontroller and software not a cheap sync chip and I've seen rotating line cubes using the method and thinking of the code to do the trig to rotate a cube means there must be some time left to do stuff.
I got to get as much info as possible because though I can fix old crt tvs I never had to know how the signal was displayed, more the common circuit failures.
The pal idea of displaying the odd lines 1,3,5 etc then flyback and display even lines 2,4,6 etc probably don't apply to a lcd tv, probably process the signal then send each line.. but not sure.
Lot's to try. If it works it would be cool.
Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is ... dunno what to say. Thanks. Yes, the idea is for b/w it's just 0 is black and 1 is white.
Incidentally, I had an email from "you" 2 years ago about composite video on pic then late last year another from "you" with a link to a seminar about snes games and how mario worked in so small memory. Not you I guess.
Anyway lots to do. Thanks. Any joy and I'll post results.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It will be For GLCDX = 0 to 127 as it's one line at a time but I haven't tried the 4uS wait then send 64 uS then 4uS wait to do a line yet and stuff I missed. I gave up on this 2 years ago but now it looks more promising.
I was thinking of a 50Hz interrupt I know and using that to do the display as tv's are 50Hz.. or were.
Lots to research and do. Thanks for the help. I'll see if any tvs I got with scart have composite video to compare with the 10" lcd tv with comp vid phono socket using to test in case. I never had a b/w tv with comp vid, just an arial socket. Cheers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm still re reading your post, lots of info, I try to make my code as fast as possible. Little things like don't use and. 2 if thens instead.
if xxx= yy then if zzz=aaa then. If 1st test fails it doesn't test next whereas and always tests both.
Probably lots of ways to make your code faster. Don't use subs put them in line. Use goto to end a loop.
Yes goto. Often seems to make sense. But I don't cos it's bad :( . bet the asm uses jump though :)
PS only used win putty to connect to rpi. I don't like command lines.
Last edit: stan cartwright 2022-01-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did some very, very basic tests. It take 123ms to send the complete array as bits with array orientation as it currently is. Meaning Y orientated bits. You may need to flip the array bits to X orientated bits so you can stream the bits out faster.
Remember, the bit orientation matches the 1306 in the library. Making this for a TV is not the same... as you are learning.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm going to look at ssd oled and the buffer and see if it could be linear as a continuous copy of the "screen" which is the point, A virtual screen that can be read and with an interrupt and some code could be composite video. Lots of timing. but I'm interested.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The representation in RAM of the display needs to optimised for the target display. Trying to using wrong representation will work... it will just be very slow.
Give it a go
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Anobium. Am I correct that a uno/nano 328 @16MHz is an instruction every clock so would16 nops would take 1uS ? Seems timing is the main problem.
I also wonder if composite pal is the same on an old crt tv as it is on a lcd monitor as the guide I'm using is for a crt tv which were slow so more sync. Lcd would have no flyback period.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium-
I have been trying to get composite b/w to work and can put bars on the screen from searching info from others using pic.
Lots of arduino examples that use "tvout" as include lib. No use to me as I can't convert the c to gcb.
I need to make a buffer and read it then send to display.
I thought of the ssd1306 and its buffer but looking at the gcb ssd1306.h include can not figure how to use the glcd graphics to just draw/print to the buffer then have access to it instead of it writing to the ssd1306.
The pic search says don't use interrupts because of latency whereas arduino tvout lib uses interrupts??
I'm using a 10"" lcd tv that's analogue rf so useless but it's got composite pal video in and apparently an lcd will tolerate poor sync signals so allowing for errors whereas using an old b/w crt tv would need better sync.
Not a priority but any thoughts?
Take a look at this site:
http://www.searle.wales/
Is it useful? I might be able to help porting if you would like but I would need NTSC.
Domenic
The SSD1306 does use a RAM buffer. It is called SSD1306_BufferAlias()
You can access the buffer directly using SSD1306_BufferAlias(0..1023) or PixelStatus_SSD1306(GLCDX, GLCDY )
Where a byte in the array is a pixel representation of the 128x64 display. Where byte are stored using this calculation GLCDX +( GLCDY / 8 )* GLCD_WIDTH + 1. So, think of the pixels being X orientated per byte in the SSD1306_BufferAlias array.
Hope this helps.
Thanks. I'll play around and see what happens.
Anobium, am I right thinking the buffer holds what's been printed/drawn and that it's like a crt tv ie top row then next then next all following in the buffer array? Like zx and cpc464 and bbcmicro, just a block of screen memory.
I tried this to test and flashes but nothing in the terminal. I probably missed something but is this how to get info from the buffer please?
I will have to strip the ssd1306 to just do the buffer... not easy but it flashed without a ssd1306 connected.
Not really Stan. I did say to use the function PixelStatus_SSD1306(GLCDX, GLCDY )
This uses ANSI to show you the pixel in the GLCD buffer but on serial terminal
Runs at 11500 BPS cus it has a lot of data to show
Last edit: Anobium 2022-01-22
If you change the code above to this - you will see the Array address being used.
You will see the following six (there are 1024 addresses shown in total) array addresses 1, 129,257,385,513,641. Yes.. every 128 because we scanning the array in this in the Y axis. And, you will see is reading the 8 bits from the array element byte. Why this seems odd - it is not. As this is the most optimal.
Proof - change the For-Next
This will show the array elements being read in sequence 1-2-3-4 but it reading the same sequence 128 more times that the other method.
So, think of the array holding data as shown is the attachment. Where XY pixels are held in the array.
:-)
Last edit: Anobium 2022-01-22
So, as i have no idea how the scan works on a TV - you need to take the next step.
@Anobium, Thanks for taking the time to explain things, it's appreciated. I should have looked up my uno code for serprint to terminal.
The info I have is for a pic at 32MHz and the timing is important.
You get 57uS of visible line scan to shift the byte in a ram buffer and switch a port pin hi/lo.
It's the 2 port with a resistor in series with each pin joined and that's the composite video out.
1 pin is b/w video and the other is the horizontal and vertical sync.
Examples are pic asm and lots of nops to get the timing.
PixelStatus_SSD1306(GLCDX, GLCDY ) takes probably longer than reading a byte from the buffer array and getting the bit. You don't get much time to do much so anything using multiplication would take too long... maybe. I'll check all options. A 16MHz Uno is twice as fast as a 32MHz pic... yes?
The idea is using just a ucontroller and software not a cheap sync chip and I've seen rotating line cubes using the method and thinking of the code to do the trig to rotate a cube means there must be some time left to do stuff.
I got to get as much info as possible because though I can fix old crt tvs I never had to know how the signal was displayed, more the common circuit failures.
The pal idea of displaying the odd lines 1,3,5 etc then flyback and display even lines 2,4,6 etc probably don't apply to a lcd tv, probably process the signal then send each line.. but not sure.
Lot's to try. If it works it would be cool.
Thanks again.
This sub (which is essentially PIXEL_STATUS will toggle the port
It still may be faster enough. You will need a scope to see how long it takes.
That is ... dunno what to say. Thanks. Yes, the idea is for b/w it's just 0 is black and 1 is white.
Incidentally, I had an email from "you" 2 years ago about composite video on pic then late last year another from "you" with a link to a seminar about snes games and how mario worked in so small memory. Not you I guess.
Anyway lots to do. Thanks. Any joy and I'll post results.
It will be For GLCDX = 0 to 127 as it's one line at a time but I haven't tried the 4uS wait then send 64 uS then 4uS wait to do a line yet and stuff I missed. I gave up on this 2 years ago but now it looks more promising.
I was thinking of a 50Hz interrupt I know and using that to do the display as tv's are 50Hz.. or were.
Lots to research and do. Thanks for the help. I'll see if any tvs I got with scart have composite video to compare with the 10" lcd tv with comp vid phono socket using to test in case. I never had a b/w tv with comp vid, just an arial socket. Cheers.
I'm still re reading your post, lots of info, I try to make my code as fast as possible. Little things like don't use and. 2 if thens instead.
if xxx= yy then if zzz=aaa then. If 1st test fails it doesn't test next whereas and always tests both.
Probably lots of ways to make your code faster. Don't use subs put them in line. Use goto to end a loop.
Yes goto. Often seems to make sense. But I don't cos it's bad :( . bet the asm uses jump though :)
PS only used win putty to connect to rpi. I don't like command lines.
Last edit: stan cartwright 2022-01-22
:-) Twas me in the past, tis me now.
Good luck - you have a good start in the code.
I did some very, very basic tests. It take 123ms to send the complete array as bits with array orientation as it currently is. Meaning Y orientated bits. You may need to flip the array bits to X orientated bits so you can stream the bits out faster.
Remember, the bit orientation matches the 1306 in the library. Making this for a TV is not the same... as you are learning.
Anobium- if the ssd buffer reads in such a way then it must be written to write the buffer that way.
https://sourceforge.net/p/gcbasic/discussion/579125/thread/e1557a95ac/0e26/attachment/Screenshot%202022-01-22%20134954.jpg
I'm going to look at ssd oled and the buffer and see if it could be linear as a continuous copy of the "screen" which is the point, A virtual screen that can be read and with an interrupt and some code could be composite video. Lots of timing. but I'm interested.
Correct approach.
The representation in RAM of the display needs to optimised for the target display. Trying to using wrong representation will work... it will just be very slow.
Give it a go
Thanks Anobium. Am I correct that a uno/nano 328 @16MHz is an instruction every clock so would16 nops would take 1uS ? Seems timing is the main problem.
I also wonder if composite pal is the same on an old crt tv as it is on a lcd monitor as the guide I'm using is for a crt tv which were slow so more sync. Lcd would have no flyback period.
I would check the data sheet. I am not able to check.
LGT will be a lot faster.
In your code "if PixelStatus_SSD1306(countx, county ) = 1 then" is irrelevant ??
oh yes... :-)
I'm using this as a guide. http://www.hpcc.ecs.soton.ac.uk/dan/pic/video_PIC.htm