Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:02 25 Nov 2024 Privacy Policy
Jump to

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 : PicoMite is fun

Author Message
pwillard
Senior Member

Joined: 07/06/2022
Location: United States
Posts: 292
Posted: 10:01am 09 Jun 2022
Copy link to clipboard 
Print this post

Ok, so I'm a noob.  But so far, my experience with the picomite (over serial until I get some additional parts) has been great.

1) I never hated basic
2) I got my first "boot to basic" computer back in 1982
2) This has been a very nostalgic experience so far.

My 80's era home computer could only wish to do what my Pico can do... so I've been giving myself challenges.

My latest challenge is to get this to work: TM1637





It's a bit tricky since it's basically a shift register (but not actually SPI) since it combines MISO and MOSI into a single bi-directional pin. It sends an ACK after 8 bits of sent data from the MCU. So, direction switching is needed.  I have the beginnings of the code done...  but the PICO seems up to the task of doing this handshake very "manually".

Anyway... off to the workbench to experiment some more.
Edited 2022-06-09 20:03 by pwillard
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9110
Posted: 10:11am 09 Jun 2022
Copy link to clipboard 
Print this post

This thread may give you some ideas
 
pwillard
Senior Member

Joined: 07/06/2022
Location: United States
Posts: 292
Posted: 10:17am 09 Jun 2022
Copy link to clipboard 
Print this post


Haha...  Now, why didn't I find that?

And it's cool that my write-byte code is similar, so I'm on the right track.

That datasheet is bloody awful.

Much thanks

Follow-up:

Using the example code provided, with some quick edits and a couple of added 'pause 0.01' commands... I got it working on my Pico.  It was kind of gibberish until I added delays near the clock pulses.

You saved me a ton of experimenting and it's appreciated.
Edited 2022-06-09 23:25 by pwillard
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 76
Posted: 09:27pm 04 May 2024
Copy link to clipboard 
Print this post

hi, pwillard

would you mind posting your code?
I had this display working on the micromite,
but despite putting a pause 0.01 after every clock or data change,
I'm still getting many spurious segments

Thanks if you do, and thanks if you don't
regs Dave
 
pwillard
Senior Member

Joined: 07/06/2022
Location: United States
Posts: 292
Posted: 01:29pm 09 May 2024
Copy link to clipboard 
Print this post

I'll need to track it down...

OK, this is not something I'm using at the moment... but it worked the last time I tried it (pretty sure)

tm1637 pico time
Edited 2024-05-09 23:40 by pwillard
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 76
Posted: 08:48pm 09 May 2024
Copy link to clipboard 
Print this post

thanks Pete !
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1873
Posted: 04:24am 22 May 2024
Copy link to clipboard 
Print this post

@ DaveJacko,  did you get this code to work, I'm connecting and getting the time but the display is blank.  
@ pwillard    any ideas
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 76
Posted: 09:01pm 22 May 2024
Copy link to clipboard 
Print this post

No joy
I have my own code that ** worked 100% on the Micromite, **
but produces largely random segments on the Pico.
I found that adding 5k pullups maybe improves things a bit.
althought there are 10k's on module
I'm going to add delays after every pin-change,
maybe try lower cpuspeed
here's the code..


' Time Bomb countdown demo 7 seg driver
' Dave J 2024

mins=1 'countdown starts at
secs=9
'dat=gp14
'clk=gp15
init

mnlp:
Pause 500
colon=colon Xor &H80

If colon Then
secs=secs-1
If secs=-1 Then
 secs=59
 mins=mins-1
EndIf
If mins=-1 Then mins=0:secs=0
EndIf

s$=Str$(secs,2,0,"0")
m$=Str$(mins,2,0,"0")

start
wrtb(&H40) 'comm1
stop

' Write COMM2 + first digit address ??
start
wrtb(&HC0) 'comm2
wrtb(dgt%(Asc(Mid$(m$,1,1))-48))
wrtb(dgt%(Asc(Mid$(m$,2,1))-48)Or colon)
wrtb(dgt%(Asc(Mid$(s$,1,1))-48))
wrtb(dgt%(Asc(Mid$(s$,2,1))-48))
stop

GoTo mnlp

'------------------- subs

Sub wrtb(b As integer) '--- write byte
tb=b
For i=0 To 7
SetPin gp15,dout 'clk lo

If (tb And 1) Then 'set bit
SetPin gp14,din
Else
SetPin gp14,dout
EndIf

SetPin gp15, din 'clk hi
tb= tb >> 1
Next i

SetPin gp15, dout 'clk lo
SetPin gp14, din 'release dat
SetPin gp15, din 'clk hi
'check ack here?
SetPin gp15, dout 'clk lo

End Sub

Sub start '-------- start
SetPin gp14,dout 'dat lo
End Sub

Sub stop '--- stop
SetPin gp14, dout 'dat lo
SetPin gp15, din ' clk hi '
SetPin gp14, din ' dat hi
End Sub

Sub init '---- initialise TM1637

Pin(gp14)=0
Pin(gp15)=0
SetPin gp14,din,pullup
SetPin gp15,din,pullup
Dim dgt%(9)=(&H3F,&H06,&H5B,&H4F,&H66,&H6D,&H7D,&H07,&H7F,&H6F)
' ,&H77,&H7C,&H39,&H5E,&H79,&H71) 'A..F
' degree symbol is &H63, C is &H39
' colon - or 2nd digit with &H80
start 'reset, enable, brightness
wrtb(&H80+8+7) '0=dim
stop

End Sub

 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024