Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Problem with INKEY$ (PicoMiteVGA V5.07.05RC4)
Author | Message | ||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 812 |
Hi, i tried to convert the fantastic program PicoMite Solar System Clock to PicoMiteVGA. It works (with MODE 2) but I have problems with INKEY$. I use "+", "-" and "r" for resetting the time. It works as expected with Tera Term but when I use the keyboard, the program does not accept any more characters after some inputs ("+"). Sometimes it still responds to "r". Why??? With Tera Term it still continues to work flawlessly... If anyone wants to try it, here is my modified code (at the moment it is not possible to reach all calendar days...): ' Converted to Pico MMBasic by Kevin Moore 07/12/2021 ' Based on Python project https://github.com/dr-mod/pico-solar-system ' which uses the planetry equations of motion from http://stjarnhimlen.se/comp/tutorial.html ' I have limited the year between 1901 and 2100 as the equations may not work beyond these. ' Touch points are ' Top Left = Brightness up ' Bottom Left = Brightness down ' Top Right = increase date by a week at a time then a month... ' Bottom Right = decrease date by a week at a time then a month... ' Centre = reset back to todays date, also re-initialise LCD display ' ' turn off default typing Option DEFAULT NONE ' force explicit typing Option EXPLICIT ' turn off blinking LED while running SetPin GP25, DOUT ' Screen = 320*240 Const width = 320 Const height = 240 Const onerad = 57.2957795131 Const update = 100 Colour RGB(WHITE), RGB(BLACK) ' Set the default colours Font 1, 3 ' Set the default font Dim m$(11) = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") Dim planet_name$(9) = ("","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune","Moon") Dim STRING dy, TASTE Dim INTEGER x, y, orbit, year, month, day, hour, min, today = 0, bright = 28 Dim INTEGER dayoff = 0, cuday, cumonth, cuyear, updatescr = update Dim INTEGER last_pos(1,9) Dim INTEGER rtcl=1 ' do we have a hardware real time clock Dim FLOAT planets_dict(1,9) Dim FLOAT xeclip, yeclip, zeclip, long2, lat2, r, Earthx, Earthy Dim FLOAT feta, coordinatex, coordinatey, seconds, lastsec=60.0, frac_s=0.0 ' set screen backlight to mid value 'Backlight bright ' Solar system centre y = height / 2 x = y Do day = Eval(Left$(Date$, 2)) ' only update planets daily or when changing or when fast scrolling If day <> today Or dayoff >= 2 Then ' re-initialise display once a day at midnight, when date changes ' If dayoff <=1 Then GUI RESET LCDPANEL If dayoff <=4 Then CLS year = Eval(Right$(Date$, 4)) month = Eval(Mid$(Date$, 4, 2)) today = day hour = Eval(Left$(Time$, 2)) min = Eval(Mid$(Time$, 4, 2)) ' call main calculations of planet positions coordinates(year, month, day, hour, min) ' results returned in planets_dict array ' draw Sun If dayoff <=4 Then Circle x, y, 10, 0, 1,, RGB(YELLOW) For orbit = 1 To 9 ' planet and orbit sizeing only for a 340*240 screen ' draw orbit rings r = 13 * orbit + 8 ' change orbit spacing for inner planets If orbit <=3 Then r=r-7+(orbit*2) : If orbit >=2 Then r=r-3 ' for speed, don't draw orbits if fast scrolling the date, no orbit for Moon If dayoff <= 2 And orbit <= 8 Then Circle x, y, r, 1, 1, RGB(BLUE), -1 : last_pos(0,orbit)=0 : last_pos(1 ,orbit)=0 ' draw planets ' Moon Special is geocentric, all others are Heliocentric If orbit = 9 Then ' Don't draw Moon if fast scrolling If dayoff <= 2 Then feta = Atan2(planets_dict(1,orbit), planets_dict(0,orbit))+1.570796327 r= 10 ' Moon orbit round Earth (keep it close) coordinatex = r * Sin(feta) + Earthx coordinatey = r * Cos(feta) + Earthy Call planet_name$(orbit) ,(coordinatex, coordinatey, last_pos(0,orbit), last_pos(1,orbit)) last_pos(0,orbit) = coordinatex last_pos(1,orbit) = coordinatey EndIf Else feta = Atan2(planets_dict(0,orbit), planets_dict(1,orbit)) coordinatex = r * Sin(feta) + x coordinatey = height - (r * Cos(feta) + y) Call planet_name$(orbit) ,(coordinatex, coordinatey, last_pos(0,orbit), last_pos(1,orbit)) last_pos(0,orbit) = coordinatex last_pos(1,orbit) = coordinatey EndIf If orbit = 3 Then Earthx=coordinatex : Earthy=coordinatey ' save Earth coordinates for Moon calcs. Next orbit ' display current date don't disply day of week if fast scrolling date If dayoff <= 2 Then dy$=Day$(Date$) If dy$="Wednesday" Then dy$="Wednesdy" Text 192, 22, dy$, "LB", 3, 1, RGB(ORANGE) EndIf Text 222, 28, Left$(Date$, 3)+m$(Eval(Mid$(Date$, 4, 2))-1), "LT", 3, 1, RGB(ORANGE) Text 252, 58, Right$(Date$,4), "LT", 3, 1, RGB(ORANGE) EndIf ' display current time and Pluto unless fast scrolling date If dayoff <= 2 Then seconds = Eval(Right$(Time$, 2)) If lastsec > seconds Then Text 204, 212, Left$(Time$, 5), "LT", 7, 4, RGB(CYAN) : seconds=0 ' update time If seconds <> lastsec Then frac_s=0 lastsec = seconds Else frac_s = frac_s+updatescr EndIf Pluto(seconds+(frac_s/1000)) EndIf Pause updatescr ' wait before doing next screen update TASTE$ = INKEY$ If TASTE$ <> "" Then If TASTE$ = "+" Then If dayoff <97 Then day = day+1 Else month = month+1 If day >28 Then day=1 : month = month+1 If month >12 Then month=1 : year = year+1 ' If year > 2100 Then year = 2100 updatescr=0 lastsec=60 dayoff = dayoff+3 Date$ = Str$(day)+"/"+Str$(month)+"/"+Str$(year) EndIf If TASTE$ = "-" Then If dayoff <97 Then day = day-1 Else month = month-1 If day <1 Then day=28 : month = month-1 If month <1 Then month=12 : year = year-1 If year <1901 Then year=1901 updatescr=0 lastsec=60 dayoff = dayoff+3 Date$ = Str$(day)+"/"+Str$(month)+"/"+Str$(year) EndIf If TASTE$ = "r" Then updatescr = update dayoff = 0 lastsec=60 today=0 If rtcl = 1 Then RTC GETTIME Else Date$ = Str$(cuday)+"/"+Str$(cumonth)+"/"+Str$(cuyear) EndIf EndIf ElseIf dayoff >2 Then dayoff = 2 ElseIf dayoff =2 Then dayoff = 1 updatescr = update ' delay between screen updates & checking for push switches EndIf Loop Sub Pluto( secs As FLOAT ) Const R = 4 Const BOUNCE = -0.98 Static Float plu_x = 290.0, plu_y = y Static Float xpos = plu_x, ypos=plu_y Static Float vel_x = -3.0 Static Integer y_height = 124, y_min = 83 Static Integer x_min = width-82 + R, x_max = width - R Static Float amplitude, x_fun, sway, height, sec2 If secs < 0.01 Then sec2=0 vel_x = Rnd*3+4 If Rnd > 0.5 Then vel_x = -(vel_x) ' update 59sec and 0 sec markers every minute. Text 236, 83, "0", "LB", 7, 1, RGB(156,166,183) Text 226, 210, "59", "LB", 7, 1, RGB(156,166,183) EndIf ' update the 30sec marker every 4 seconds while less than 35 seconds If secs >= sec2 And secs <= 35 Then sec2 = secs+2 : Text 308, 150, "30", "LB", 7, 1, RGB(156,166,183) amplitude = (60-secs)/60 x_fun = secs - Fix( secs ) sway = 1 - ((((x_fun/0.5)-1)^2) * (-1) + 1) height = y_height * amplitude plu_y = (height * sway) + y_height - height + y_min plu_x = plu_x + vel_x If plu_x >= x_max Then vel_x = vel_x * BOUNCE plu_x = x_max ElseIf plu_x <= x_min Then vel_x = vel_x * BOUNCE plu_x = x_min EndIf Box xpos-4, ypos-4, 9, 9, 0,, RGB(0,0,0) ' blank Pluto Circle plu_x, plu_y, R, 0, 1,, RGB(156,166,183) 'Pluto xpos = plu_x ypos = plu_y End Sub Sub Mercury(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-2, ypos-2, 5, 5, 0,, RGB(0,0,0) ' blank Mercury Circle xs, ys, 2, 0, 1,, RGB(213,178,138) 'Mercury End Sub Sub Venus(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-4, ypos-4, 9, 9, 0,, RGB(0,0,0) ' blank Venus Circle xs, ys, 4, 0, 1,, RGB(179,102,22) 'Venus End Sub Sub Earth(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-6, ypos-6, 13, 13, 0,, RGB(0,0,0) ' blank Earth Circle xs, ys, 6, 0, 1,, RGB(126,152,203) 'Earth ' don't draw planet details if fast scrolling If dayoff <=2 Then Line xs-1,ys-6, xs+1,ys-6, 1, RGB(WHITE) Line xs-3,ys+5, xs+3,ys+5, 1, RGB(WHITE) Line xs-1,ys+6, xs+1,ys+6, 1, RGB(WHITE) Circle xs+1,ys+1, 3, 2, 1.5, RGB(230,230,250), -1 Circle xs-2, ys-1, 4, 0, 0.6,, RGB(30,255,20) EndIf End Sub Sub Mars(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-3, ypos-3, 7, 7, 0,, RGB(0,0,0) ' blank Mars Circle xs, ys, 3, 0, 1,, RGB(234,169,111) 'Mars End Sub Sub Jupiter(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) ' don't draw planet details if fast scrolling Box xpos-7, ypos-7, 15, 15, 0,, RGB(0,0,0) ' blank Jupiter Circle xs, ys, 7, 0, 1,, RGB(185,191,153) 'Jupiter If dayoff <=2 Then Line xs-5,ys-5,xs+5,ys-5, 1, RGB(182,134,86) Line xs-7,ys-3,xs+7,ys-3, 2, RGB(182,134,86) Line xs-7,ys+1,xs+7,ys+1, 2, RGB(202,150,100) Line xs-5,ys+5,xs+5,ys+5, 1, RGB(202,150,100) Circle xs+2,ys+2, 2, 0, 1.75,, RGB(230,144,91) EndIf End Sub Sub Saturn(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-7, ypos-7, 15, 15, 0,, RGB(0,0,0) ' blank Saturn Line xpos-14, ypos, xpos+14, ypos, 2, RGB(0,0,0) Circle xs, ys, 6, 0, 1,, RGB(222,182,113) 'Saturn Line xs-14, ys, xs+14, ys, 2, RGB(141,124,104) End Sub Sub Uranus(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-5, ypos-5, 11, 11, 0,, RGB(0,0,0) ' blank Uranus Circle xs, ys, 5, 0, 1,, RGB(173,217,244) 'Uranus End Sub Sub Neptune(xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-5, ypos-5, 11, 11, 0,, RGB(0,0,0) ' blank Neptune Circle xs, ys, 5, 0, 1,, RGB(116,142,193) 'Neptune End Sub Sub Moon( xs As INTEGER, ys As INTEGER, xpos As INTEGER, ypos As INTEGER) Box xpos-2, ypos-2, 5, 5, 0,, RGB(0,0,0) ' blank Moon Circle xs, ys, 2, 0, 1,, RGB(250,250,250) 'Moon End Sub 'Function Modulus(angle As FLOAT) As FLOAT ' Modulus = angle - Int(angle/360.0)*360.0 'End Function Sub from_sun(m As FLOAT, e As FLOAT, a As FLOAT, ns As FLOAT, w As FLOAT, ic As FLOAT) Local FLOAT m2, e0, e02, e1, x, y, r, vs, vc, nc m2 = Rad(m) e0 = (m + onerad * e * Sin(m2) * (1 + e * Cos(m2))) Mod 360 e02 = Rad(e0) e1 = Rad((e0 - (e0 - onerad * e * Sin(e02) - m) / (1 - e * Cos(e02))) Mod 360) x = a * (Cos(e1) - e) y = a * (Sqr(1 - e * e)) * Sin(e1) ' return value r r = Sqr(x * x + y * y) vs = Rad((Deg(Atan2(y, x)) Mod 360) + w) vc = Cos(vs) vs = Sin(vs) ns = Rad(ns) nc = Cos(ns) ns = Sin(ns) zeclip = r * vs * Sin(Rad(ic)) ic = Cos(Rad(ic)) ' return values xeclip, yeclip, long2, lat2 xeclip = r * (nc * vc - ns * vs * ic) yeclip = r * (ns * vc + nc * vs * ic) long2 = (Deg(Atan2(yeclip, xeclip))) Mod 360 lat2 = Deg(Atan2(zeclip, Sqr(xeclip * xeclip + yeclip * yeclip))) End Sub ' results returned in array planets_dict Sub coordinates(year%, month%, day%, hour%, minute%) Local INTEGER jdn Local FLOAT jd, d, w, e, m2, m, e_capt, x, y, r, v, lon, x2, y2 Local FLOAT n_mo, i_mo, w_mo, a_mo, e_mo, m_mo Local FLOAT n_er, i_er, w_er, a_er, e_er, m_er Local FLOAT n_af, i_af, w_af, a_af, e_af, m_af Local FLOAT n_ar, i_ar, w_ar, a_ar, e_ar, m_ar Local FLOAT n_di, i_di, w_di, a_di, e_di, m_di Local FLOAT n_kr, i_kr, w_kr, a_kr, e_kr, m_kr Local FLOAT n_ou, i_ou, w_ou, a_ou, e_ou, m_ou Local FLOAT n_po, i_po, w_po, a_po, e_po, m_po Local FLOAT di_diat1, di_diat2, di_diat3, di_diat4, di_diat5, di_diat6, di_diat7 Local FLOAT kr_diat1, kr_diat2, kr_diat3, kr_diat4, kr_diat5, kr_diat6, kr_diat7 Local FLOAT ou_diat1, ou_diat2, ou_diat3 Local FLOAT diataraxes_long_di, diataraxes_long_kr, diataraxes_lat_kr, diataraxes_long_ou Local FLOAT long2_di, coslat2_di, r_di, long2_kr, coslat2_kr, r_kr Local FLOAT long2_ou, coslat2_ou, r_ou jdn = ((367*year%-(7*(year%+((month%+9)\12))\4))+(275*month%\9)+(day%+1721013.5)) jd = (jdn + hour% / 24. + minute% / 1440.) d = jd - 2451543.5 w = 282.9404 + 4.70935E-5 * d e = (0.016709 - (1.151E-9 * d)) m2 = (356.047 + 0.9856002585 * d) Mod 360 m = Rad( m2 ) e_capt = Rad(m2 + onerad * e * Sin(m) * (1 + e * Cos(m))) x = Cos(e_capt) - e y = Sin(e_capt) * Sqr(1 - e * e) r = Sqr(x * x + y * y) v = Deg(Atan2(y, x)) lon = Rad((v + w) Mod 360) x2 = r * Cos(lon) y2 = r * Sin(lon) ' Earth coords planets_dict(0,3) = -1 * x2 planets_dict(1,3) = -1 * y2 n_mo = 125.1228 - 0.0529538083 * d ' (Long asc. node) i_mo = 5.1454 ' (Inclination) w_mo = 318.0634 + 0.1643573223 * d ' (Arg. of perigee) a_mo = 60.2666 ' (Mean distance) e_mo = 0.054881 ' (Eccentricity) m_mo = (115.3654 + 13.0649929509 * d) Mod 360 ' (Mean anomaly) n_er = 48.3313 + 3.24587E-5 * d i_er = 7.0047 + 5.00E-8 * d w_er = 29.1241 + 1.01444E-5 * d a_er = 0.387098 e_er = 0.205635 + 5.59E-10 * d m_er = (168.6562 + 4.0923344368 * d) Mod 360 n_af = 76.6799 + 2.46590E-5 * d i_af = 3.3946 + 2.75E-8 * d w_af = 54.8910 + 1.38374E-5 * d a_af = 0.723330 e_af = 0.006773 - 1.30E-9 * d m_af = (48.0052 + 1.6021302244 * d) Mod 360 n_ar = 49.5574 + 2.11081E-5 * d i_ar = 1.8497 - 1.78E-8 * d w_ar = 286.5016 + 2.92961E-5 * d a_ar = 1.523688 e_ar = 0.093405 + 2.51E-9 * d m_ar = (18.6021 + 0.5240207766 * d) Mod 360 n_di = 100.4542 + 2.76854E-5 * d i_di = 1.3030 - 1.557E-7 * d w_di = 273.8777 + 1.6450E-5 * d a_di = 5.20256 e_di = 0.048498 + 4.469E-9 * d m_di = (19.8950 + 0.0830853001 * d) Mod 360 n_kr = 113.6634 + 2.38980E-5 * d i_kr = 2.4886 - 1.081E-7 * d w_kr = 339.3939 + 2.97661E-5 * d a_kr = 9.55475 e_kr = 0.055546 - 9.499E-9 * d m_kr = (316.9670 + 0.0334442282 * d) Mod 360 n_ou = 74.0005 + 1.3978E-5 * d i_ou = 0.7733 + 1.9E-8 * d w_ou = 96.6612 + 3.0565E-5 * d a_ou = 19.18171 - 1.55E-8 * d e_ou = 0.047318 + 7.45E-9 * d m_ou = (142.5905 + 0.011725806 * d) Mod 360 n_po = 131.7806 + 3.0173E-5 * d i_po = 1.7700 - 2.55E-7 * d w_po = 272.8461 - 6.027E-6 * d a_po = 30.05826 + 3.313E-8 * d e_po = 0.008606 + 2.15E-9 * d m_po = (260.2471 + 0.005995147 * d) Mod 360 from_sun(m_mo, e_mo, a_mo, n_mo, w_mo, i_mo) planets_dict(0,9) = xeclip planets_dict(1,9) = yeclip ' return values in xeclip, yeclip, long2, lat2, r from_sun(m_er, e_er, a_er, n_er, w_er, i_er) planets_dict(0,1) = xeclip planets_dict(1,1) = yeclip from_sun(m_af, e_af, a_af, n_af, w_af, i_af) planets_dict(0,2) = xeclip planets_dict(1,2) = yeclip from_sun(m_ar, e_ar, a_ar, n_ar, w_ar, i_ar) planets_dict(0,4) = xeclip planets_dict(1,4) = yeclip ' return values in xeclip, yeclip, long2, lat2, r from_sun(m_di, e_di, a_di, n_di, w_di, i_di) long2_di = long2 coslat2_di = Cos(Rad(lat2)) r_di = r from_sun(m_kr, e_kr, a_kr, n_kr, w_kr, i_kr) long2_kr = long2 coslat2_kr = lat2 r_kr = r from_sun(m_ou, e_ou, a_ou, n_ou, w_ou, i_ou) long2_ou = long2 coslat2_ou = Cos(Rad(lat2)) r_ou = r from_sun(m_po, e_po, a_po, n_po, w_po, i_po) planets_dict(0,8) = xeclip planets_dict(1,8) = yeclip m_di = m_di Mod 360 m_kr = m_kr Mod 360 m_ou = m_ou Mod 360 di_diat1 = -0.332 * Sin(Rad(2 * m_di - 5 * m_kr - 67.6)) di_diat2 = -0.056 * Sin(Rad(2 * m_di - 2 * m_kr + 21)) di_diat3 = 0.042 * Sin(Rad(3 * m_di - 5 * m_kr + 21)) di_diat4 = -0.036 * Sin(Rad(m_di - 2 * m_kr)) di_diat5 = 0.022 * Cos(Rad(m_di - m_kr)) di_diat6 = 0.023 * Sin(Rad(2 * m_di - 3 * m_kr + 52)) di_diat7 = -0.016 * Sin(Rad(m_di - 5 * m_kr - 69)) kr_diat1 = 0.812 * Sin(Rad(2 * m_di - 5 * m_kr - 67.6)) kr_diat2 = -0.229 * Cos(Rad(2 * m_di - 4 * m_kr - 2)) kr_diat3 = 0.119 * Sin(Rad(m_di - 2 * m_kr - 3)) kr_diat4 = 0.046 * Sin(Rad(2 * m_di - 6 * m_kr - 69)) kr_diat5 = 0.014 * Sin(Rad(m_di - 3 * m_kr + 32)) kr_diat6 = -0.02 * Cos(Rad(2 * m_di - 4 * m_kr - 2)) kr_diat7 = 0.018 * Sin(Rad(2 * m_di - 6 * m_kr - 49)) ou_diat1 = 0.04 * Sin(Rad(m_kr - 2 * m_ou + 6)) ou_diat2 = 0.035 * Sin(Rad(m_kr - 3 * m_ou + 33)) ou_diat3 = -0.015 * Sin(Rad(m_di - m_ou + 20)) diataraxes_long_di = (di_diat1 + di_diat2 + di_diat3 + di_diat4 + di_diat5 + di_diat6 + di_diat7) diataraxes_long_kr = (kr_diat1 + kr_diat2 + kr_diat3 + kr_diat4 + kr_diat5) diataraxes_lat_kr = (kr_diat6 + kr_diat7) diataraxes_long_ou = (ou_diat1 + ou_diat2 + ou_diat3) long2_di = Rad(long2_di + diataraxes_long_di) long2_kr = Rad(long2_kr + diataraxes_long_kr) coslat2_kr = Cos(Rad(coslat2_kr + diataraxes_lat_kr)) long2_ou = Rad(long2_ou + diataraxes_long_ou) planets_dict(0,5) = r_di * Cos(long2_di) * coslat2_di planets_dict(1,5) = r_di * Sin(long2_di) * coslat2_di planets_dict(0,6) = r_kr * Cos(long2_kr) * coslat2_kr planets_dict(1,6) = r_kr * Sin(long2_kr) * coslat2_kr planets_dict(0,7) = r_ou * Cos(long2_ou) * coslat2_ou planets_dict(1,7) = r_ou * Sin(long2_ou) * coslat2_ou End Sub Frank |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8516 |
Set OPTION CPUSPEED 378000 and that seems to solve it. All I can assume is that the firmware is dropping H/W interrupts possibly because there is so much FP going on. You can make the display much better with Dim FLOAT feta, coordinatex, coordinatey, seconds, lastsec=60.0, frac_s=0.0 FRAMEBUFFER create FRAMEBUFFER write f ' set screen backlight to mid value FRAMEBUFFER copy f,n Pause updatescr ' wait before doing next screen update Out of interest try PicoMiteVGA.zip which seems somewhat better to me Originally I was copying the RP2040 FP routines from its ROM to RAM for performance reasons as part of the linker options. In this version I run them directly from ROM. In the RAM version the ROM has a stub which calls the RAM copy (it is an official option) but it may be there is some additional interaction with H/W interrupts |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 812 |
Hi Peter, I tried your version - it seems to be better. It also works better with OPTION CPUSPEED 378000, but the program also hangs after a while... Could the input be solved more elegantly? THANKS! Frank |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3422 |
Hi Frank, Peter, I tried to duplicate Franks problem, but on my platform (GAMEpicoVGA 1.4) with my keyboard, I cannot duplicate the original problem. OPTIONS: option list PicoMiteVGA MMBasic Version 5.07.05RC4 OPTION COLOURCODE ON OPTION KEYBOARD US OPTION SDCARD GP13, GP11, GP12, GP10 OPTION AUDIO GP6,GP7, ON PWM CHANNEL 3 OPTION F5 mode 1:edit Is there something you want met to try to get to the bottom of this ? Could the problem lie in de PS2 key repeat, or in the PS2 clock speed, the language (DE) ? The waveforms look pristine (nice squarewaves on both 3.3V and 5V side of the level shifter). Just let me know... Volhout Edited 2022-10-01 03:38 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 812 |
Hi Volhout, here are my options: option list PicoMiteVGA MMBasic Version 5.07.05RC4 OPTION SYSTEM I2C GP14,GP15 OPTION COLOURCODE ON OPTION KEYBOARD GR OPTION DISPLAY 60, 106 OPTION SDCARD GP13, GP10, GP11, GP12 OPTION AUDIO GP6,GP7, ON PWM CHANNEL 3 OPTION RTC AUTO ENABLE OPTION DEFAULT FONT 7, 1 I don't think it's because of the PS2 key repeat, or in the PS2 clock speed. I have the same problem (at default speed) when I press the "+" key about 10-15 times at a second interval. Suddenly, the key no longer responds! It still works via terminal. Sometimes it works again when I then press "-" or "r". If interrupts are lost, shouldn't the system hang??? If I then repeatedly press "+" on the keyboard, I have the same problem again... There are no difficulties with you? Strange!!! Can you maybe activate a RTC in your system? Frank |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 812 |
...is it possible that we have a firmware problem after all? I had the INKEY characters printed out once - after some time I only get an "l" back when I press "+". Especially it seems to get better if I set the repeatrate under OPTION KEYBOARD to "0"??? Shouldn't it get worse there??? Frank |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8516 |
If you want this looked at you need to produce a small demonstration program that I can work with. Have you tested with different PS2 keyboards? |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3422 |
Frank, The picomite consists of a cpu module on a circuit board. To connent to the keyboard you need power and a 5V logic serial bus. Old keyboards definitely need 5V power (more than 4.75V). Can you check if the 5V on the ps2 connector is 4.75V? Then the 5V serial bus is created using a level shifter circuit (the pico is 3.3V). Do you use a le el shifter module? Or do you use discrete FET's? Can you check that the level shifter works. (Without keyboard attached, are the clock and data pin 5V?). If you use discrete FETs, are they in the correct orientation.? Maybe send a photo, and the type number of the parts used. It could be they are mounted reversed (there are different connections for parts that look the same from the outside). From what you are saying, this could be a hardware problem, that is why the above questions. Volhout Finally you could check what happens when you switch the keyboard option to US or UK (this is the default). If behaviour changes then we know where to look for. Edited 2022-10-05 06:15 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
I'd definitely look at the keyboard voltage - remembering that you can't power the keyboard from 5V (which it may need) and connect it direct to the Picomite pins! Some PS/2 keyboards are partially functional at 3V3 but not reliable. Also, if there is a level shifter using 2N7000 MOSFETs you need to note that in the usual circuit they are actually being asked to work out of specification - but they usually do in my experience. Are you using one of the known PicoMite VGA PCBs Frank? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8516 |
Also note 2N7000 do not guarantee to meet the spec in the application note. The mosfet I specify do. |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 812 |
Hi, I have a PicoMiteVGA V1.3 PCB with two TN0702N3-G: I have no other problems with the keyboard - I had used it successfully on all projects so far (Maximite, Duinomite, Colormaximite, Colormaximite2). It is a CHERRY G84-4100. Am I the only one who has this problem with the above code??? I will try other keyboards and completely reset and reflash the µC. Frank |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3422 |
Hi Frank, I tried your code on the same picomite PCB (Peter's design 1.4) and cannot reproduce your problem. Used a small PS2 keyboard. Both with key repeat, and with single key presses the data changes, as does the clock. Tried with a different (older) PS2 keyboard. I can see no problems. There must be something related to your keyboard (since we use the same picomite platform). Did you measure the voltage at the PS2 connector ? Looks like you power from the barrel connector. What diode do you use for D1 ? iN5819? Or 1N4001 ? Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 871 |
I've done the same with the PicoMite Game Board (with 2N7000 transistors) a new PS2 keyboard. The Program runns without errors MMBasic 5.07.05RC6, CLOCKSPEED 378000 and the Modefication that Peter suggested. Maybee there is something (special) with your Keyboard . Cheers Mart!n btw: Nice little Program Edited 2022-10-05 21:11 by Martin H. 'no comment |
||||
Print this page |