![]() |
Forum Index : Microcontroller and PC projects : CMM2 Stop Screen Scrolling
Author | Message | ||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1097 |
Hi, Is there a way to prevent the CMM2 screen from scrolling upwards if a PRINT @(x,y) data statement goes beyond the bottom of the screen? I thought I read something about it somewhere, but I can't remember where. I'm monitoring received data & I think the odd CR/LF comes through & upsets things. (I probably could trap any CR/LF's before printing) Thanks Brian ChopperP |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
Putting a semicolon on the end of the string part might help - it supresses the linefeed for that print statement. However if the Y value is actually off the bottom of the screen I'm not sure it would help. i.e. PRINT @(x,y) "Sometext"; |
||||
TweakerRay![]() Senior Member ![]() Joined: 01/08/2020 Location: GermanyPosts: 138 |
I have done a tutorial to my chiptune drumsynth... https://youtu.be/vKMbMjoa0P4 The download to that programm is also in the description of that youtube video. Hope some enjoy this ;-) http://tweakerray.bandcamp.com |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1097 |
@ PeteCotton Thanks. Will experiment @ TweakerRay. Nice program but not quite sure how this answers my question. Brian ChopperP |
||||
Womble![]() Senior Member ![]() Joined: 09/07/2020 Location: United KingdomPosts: 267 |
Brian ... You could write a wrapper for the PRINT statement to check for screen boundaries. I did something like that here with my "Glocate" SUB SUB Glocate row%, col% LOCAL x% = col% LOCAL y% = row% IF x% < 0 OR x% > ( MM.HRES \ MM.INFO(FONTWIDTH) ) THEN 'max character in row x% = MM.HRES \ MM.INFO(FONTWIDTH) 'set to max characters ENDIF IF y% < 0 OR y% > ( MM.VRES \ MM.INFO(FONTHEIGHT) ) THEN 'max rows onscreen y% = MM.VRES \ MM.INFO(FONTHEIGHT) 'set to max rows ENDIF PRINT @((MM.INFO(FONTWIDTH)*x%),(MM.INFO(FONTHEIGHT)*y%))""; 'position cursor 'where x is the character column, and y is the character row END SUB Any checks for stray CR/LF data could be incorporated here too. Regards Womble |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1097 |
Thanks for that Womble. I experimented with some code to check for CR/LF & put this into service this morning into the ISR's of the 2 COM ports for testing. I figured that the CMM2 was fast enough to handle it here. Two lots of data come in on one channel & one on the other. All 3 get printed (in sequence) to same part of the screen. Been running all day & so far all OK. No screen scrolling at all. See how it goes. It took me a while to realise that if the CR is not replaced as well (if not at the end), the remaining part of the message will overwrite the first section & thus not display correctly. sub Com_Int 'interrupt routine for com port 1 local x Cont_Data$ = input$(113, #1) 'Get Data String. Should be 113 bytes inc LF & CR bytes Data_Flag = 1 'set data flag on Data receive for x = 1 to 111 'first 111 bytes if asc(mid$(cont_data$, x, 1)) = 13 then 'check for CR mid$(Cont_Data$,x,1) = " " 'replace with a space else if asc(mid$(cont_data$, x, 1)) = 10 then 'check for LF mid$(Cont_Data$, x,1) = " " 'replace with a space endif NEXT x 'next chr print @(0, 552) time$ " " left$(Cont_Data$,111) :Print @(0,0)'print to screen end sub Brian ChopperP |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |