Created
August 11, 2025 10:20
-
-
Save mdavey/0f281fcaeea33f9d4d2a879cb9024631 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Power dbm/watts conversion program for MMBasic | |
sub Wait_For_Enter () | |
INPUT "Press enter to return to menu..."; DUMMY$ | |
end sub | |
Sub Dbm_To_Watts() | |
CLS | |
INPUT "Enter power in dBm: ", DBM | |
WATTS = (10 ^ (DBM / 10)) / 1000 | |
PRINT DBM; " dBM is equal to "; WATTS; " watts" | |
Wait_For_Enter() | |
end sub | |
Sub Watts_To_Dbm() | |
CLS | |
INPUT "Enter power in watts: ", WATTS | |
IF WATTS <= 0 THEN | |
PRINT "Invalid input." | |
Wait_For_Enter() | |
return | |
endif | |
DBM = 10 * (LOG(WATTS * 1000) / LOG(10)) | |
PRINT WATTS; " watts is equal to "; DBM; " dBm." | |
Wait_For_Enter() | |
END SUB | |
MAIN_MENU: | |
CLS | |
PRINT "RF Power Conversions" | |
PRINT "Options:" | |
PRINT "1. dBm to wats" | |
PRINT "2. Watts to dBm" | |
PRINT "3. Exit" | |
INPUT "Enter choice (1, 2, OR 3): ", CHOICE | |
IF CHOICE = 1 THEN Dbm_To_Watts() | |
IF CHOICE = 2 THEN Watts_To_Dbm() | |
IF CHOICE = 3 THEN END | |
GOTO MAIN_MENU |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment