This is a port from the Casio CG50 that is on going on this thread / post, which consists in a Electronics Calculator for some components and currently is being developed on TI CXII-T non-cas :


https://www.cemetech.net/forum/viewtopic.php?t=16393

It will provide same functionality as the Casio and is written in BASIC, please read the description on the link for further details.

For now just Resistive Diivider:

- Vout= Vin*(R2/(R1+R2))

2020-03-23:
-----------------
- Added simple / single condition for zero input for typing error
- Approximate result for Vout.
- Use optimization sugested by Izder456 for Disp value in same line... not seen in the manual... Thanks

2020-03-24:

- Added link for git repository for future updates for now on



Code:


Code:

Define rdiv()=
Prgm
:Disp "Resistive Divider"
:Request "Vin?",vin
:Request "R1?",r1
:Request "R2?",r2
:If r2=0 Then
: Disp "Error Div Zero"
: Goto end
:EndIf
:vout:=approx(((r2)/(r1+r2))*vin)
:Disp "Vout="&string(vout)
:Lbl end:
:Disp "End"
:EndPrgm



Later i'll put on git repo for further and easier updates:

https://github.com/malagasonfire/electronicscalc.git
Is this in Ti-BASIC?
If so, this could be ported to the older nspire's like the ones you see in schools [or at least mine]

^^ignore^^

EDIT: oops didn't read guess it IS in Ti-BASIC, and it can be ported, with the loss of colour... oh well.

EDIT2:
the code could be optimised to this :

Code:

Define rdiv(vin, r1, r2)=
Prgm
Disp "Resistive divider"
// Request "Vin?",vin <--can be passed in as arguments
// Request "R1?",r1  ^^
// Request "R2",r2  ^^
vout:=((r2)/(r1+r2))*vin
Disp "Vout="&string(vout)
// Disp vout // dont need this anymore because of string appending with &
EndPrgm
Thank you for you're attention and optimizations. i'm fairly new to the BASIC and just getting started. i'll update the code later on
malagas_fire wrote:
Later i'll put on git repo for further and easier updates:


link to repo?
Izder456 wrote:
link to repo?


It's on the description of first post:


https://github.com/malagasonfire/electronicscalc.git

I've updated recently and added a crude menu using text to represent menu choices and a Request input . Also added the R2/(R2+R1) approximation. it is now faily close to the original one on the Casio CG50.
Update on repository :

- Added know list of resistors values.
Update: Added Resistor Color Codes as Option 3
Added some pauses between resistor color codes using getKey(1), to mimic Disps as in the CG50
malagas_fire wrote:
Update: Added Resistor Color Codes as Option 3
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement