20-02-2021, 03:34
Hola Amigos:
Cuando era estudiante, allá por 1978 mis padres me compraron la calculadora Texas Instruments SR-51-II, la cual aún conservo, aunque tuve que ponerle un paquete de baterías adaptado. Bueno, ante el encierro de la pandemia, y salir de la monotonía me propuse hacer el proyecto de esta calculadora en Gambas3. Confieso que al programar cada función del teclado reconozco que para la época, los circuitos integrados de este calculador, debieron ser bastante desarrollados para su época. Aquí pongo el código resultante (que aún está inconcluso, pero funcional en un 95% diría yo) y una imagen. El manual se puede descargar de la web, por si alguien gusta consultarlo y seguir con la programación para mejorarla.
![[Imagen: BXmpCA0.png]](https://i.imgur.com/BXmpCA0.png)
Espero que haya entusiastas que les llame la atención este proyecto....Saludos.
Cuando era estudiante, allá por 1978 mis padres me compraron la calculadora Texas Instruments SR-51-II, la cual aún conservo, aunque tuve que ponerle un paquete de baterías adaptado. Bueno, ante el encierro de la pandemia, y salir de la monotonía me propuse hacer el proyecto de esta calculadora en Gambas3. Confieso que al programar cada función del teclado reconozco que para la época, los circuitos integrados de este calculador, debieron ser bastante desarrollados para su época. Aquí pongo el código resultante (que aún está inconcluso, pero funcional en un 95% diría yo) y una imagen. El manual se puede descargar de la web, por si alguien gusta consultarlo y seguir con la programación para mejorarla.
Código:
GAMBAS- ' Gambas class file
-
-
-
- lblDisplay.Text = "Error"
- lblDisplay.Text = 1 / acum
- acum = 0
-
-
- lblDisplay.Text = varianza
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
- acum = 0
- cuenta = 0
- lblDisplay.Text = "Error"
-
- ' La Desviaci\F3n Estandar (S. DEV) se calcula con la formula:
- ' SD = SQR((Sumatoria de (abs(x - promedio) ^ 2)) / numdatos)
- ' Calculamos la sumatoria. (El promedio MEAN ya lo tenemos)
-
- varianza = modulo / numdato
- lblDisplay.Text = sdev
-
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
- mem1 = mem1 + dato[numdato]
-
- numdato = numdato + 1
- lblDisplay.Text = numdato
- cuenta = 0
-
- 'numdato = numdato - 1
-
-
-
- fmemw = False
- fmemr = False
- fmems = False
- fmemp = False
- fmeme = False
- grad = False
- suma = False
- resta = False
- divide = False
- multiplica = False
- raiz = False
- potencia = False
- sto = False
- rcl = False
- sum = False
- rest = False
- prod = False
- divi = False
- deltaporc = False
- porciento = False
- exc = False
- punto = False
- segunda = False
- inv = False
- fixes = False
- porciento = False
-
- mem1 = 0
- mem2 = 0
- mem3 = 0
- lblDisplay.Text = "0"
- lblgrados.Caption = "DEG"
- 'Pi 3.141592654
- dato = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- numdato = 0
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- cmdProd.Background = Color.Orange
-
- cmd2nd.Background = Color.Red
- segunda = True
-
-
-
-
-
-
-
-
-
- cuenta = 0
- lblDisplay.Text = "0"
-
- cmdIgual_Click
- tempo1 = acum
-
-
-
-
-
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
-
-
-
-
-
-
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
- punto = False
- divide = True
- cuenta = 0
-
- 'lblDisplay.Text = fact(valor)
-
- segunda = False
-
-
- lblDisplay.Text = valor
-
- lblDisplay.Text = valor
-
-
- lblDisplay.Text = valor
-
- lblDisplay.Text = valor
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- cmdINV.Background = Color.Red
- inv = True
-
-
- lblDisplay.Text = "Error"
-
-
- lblDisplay.Text = "Error"
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
-
- grad = False
- lblgrados.Caption = "RAD"
- segunda = False
-
- cmd2nd.Background = &H808080
-
-
- punto = False
- multiplica = True
- cuenta = 0
-
- 'lblDisplay.Text = fact(valor)
-
- segunda = False
-
- raiz = True
- cuenta = 0
-
-
- 'Dim digi As Integer
- factorial = 1
-
- factorial = factorial * i
-
- lblDisplay.Text = factorial
- segunda = False
- cmd2nd.Background = &H808080
-
-
- fmems = True
-
- fmemp = True
-
-
-
-
-
-
-
-
-
-
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
-
-
-
-
- cantidad = numdato - 1
- mean = 0
- mean = mean + dato[ii]
-
- mean = mean / numdato
- lblDisplay.Text = mean
- lblDisplay.Text = "Error"
-
-
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
- potencia = True
- cuenta = 0
- acum = 0
-
-
-
-
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
- lblDisplay.Text = ""
- lblDisplay.Text = "0"
- lblDisplay.Text = lblDisplay.Text & "0"
- cuenta = cuenta + 1
-
- xx = acum
-
-
- lblDisplay.Text = tempo2
- tempo1 = 0
- tempo2 = 0
- acum = 0
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
- 'Esta tecla pone en display un 1
- 'Es Mem1 para STO
- 'Es Mem1 para RCL
- 'Es Mem1 para EXC con 2nd
- 'Es Mem1 para SUM
- 'Es Mem1 para RESTA con INV
- 'Es Mem1 para PROD con 2nd
- 'Es Mem1 para DIV con 2nd e INV
- 'Convierte de \B0F a \B0C con 2nd
- 'Convierte de \B0C a \B0F con 2nd e INV
-
- lblDisplay.Text = "1"
- lblDisplay.Text = lblDisplay.Text & "1"
-
- cuenta = cuenta + 1
-
- fmemw = False
- cuenta = 0
-
- lblDisplay.Text = mem1
- fmemr = False
- cuenta = 0
-
- mem1 = mem1 + acum
- fmems = False
- cuenta = 0
-
-
- xx = acum
-
-
- lblDisplay.Text = (acum - 32) * (5 / 9)
- acum = 0
- cuenta = 0
-
- mem1 = mem1 * acum
- acum = 0
-
- tempo1 = mem1
- lblDisplay.Text = tempo1
- tempo1 = 0
- acum = 0
-
- decifix = "0.0"
-
-
-
-
-
-
-
- lblDisplay.Text = (9 * acum / 5) + 32
- acum = 0
- cuenta = 0
-
- mem1 = acum / mem1
- acum = 0
-
-
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- 'Esta tecla pone en display un 2
- 'Es Mem2 para STO
- 'Es Mem2 para RCL
- 'Es Mem2 para EXC con 2nd
- 'Es Mem2 para SUM
- 'Es Mem2 para RESTA con INV
- 'Es Mem2 para PROD con 2nd
- 'Es Mem2 para DIV con 2nd e INV
- 'Convierte de DEG a RAD con 2nd
- 'Convierte de RAD a DEG con 2nd e INV
-
- lblDisplay.Text = "2"
- lblDisplay.Text = lblDisplay.Text & "2"
- cuenta = cuenta + 1
-
- fmemw = False
- cuenta = 0
-
- lblDisplay.Text = mem2
- fmemr = False
- cuenta = 0
-
- xx = acum
- cuenta = 0
-
- mem2 = mem2 + acum
- fmems = False
- cuenta = 0
-
-
- acum = 0
- cuenta = 0
-
- mem2 = mem2 * acum
- acum = 0
- cuenta = 0
-
- tempo1 = mem2
- lblDisplay.Text = tempo1
- tempo1 = 0
- acum = 0
-
-
-
-
-
-
- acum = 0
- cuenta = 0
-
- mem2 = acum / mem2
- acum = 0
- cuenta = 0
-
-
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- 'Esta tecla pone en display un 3
- 'Es Mem3 para STO
- 'Es Mem3 para RCL
- 'Es Mem3 para EXC con 2nd
- 'Es Mem3 para SUM
- 'Es Mem3 para RESTA con INV
- 'Es Mem3 para PROD con 2nd
- 'Es Mem3 para DIV con 2nd e INV
- 'Convierte de GRAD a RAD con 2nd
- 'Convierte de RAD a GRAD con 2nd e INV
-
- lblDisplay.Text = "3"
- lblDisplay.Text = lblDisplay.Text & "3"
- cuenta = cuenta + 1
-
- fmemw = False
- cuenta = 0
-
- lblDisplay.Text = mem3
- fmemr = False
- cuenta = 0
-
- xx = acum
- cuenta = 0
-
- mem3 = mem3 + acum
- fmems = False
- cuenta = 0
-
-
- acum = 0
- cuenta = 0
-
- mem3 = mem3 * acum
- acum = 0
- cuenta = 0
-
- tempo1 = mem3
- lblDisplay.Text = tempo1
- tempo1 = 0
- acum = 0
-
-
-
-
-
-
- acum = 0
- cuenta = 0
-
- mem3 = acum / mem3
- acum = 0
- cuenta = 0
-
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- lblDisplay.Text = "4"
- lblDisplay.Text = lblDisplay.Text & "4"
- cuenta = cuenta + 1
-
- lblDisplay.Text = acum * 25.4
- acum = 0
-
- lblDisplay.Text = acum / 25.4
- acum = 0
-
-
-
- xx = acum
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
- lblDisplay.Text = "5"
- lblDisplay.Text = lblDisplay.Text & "5"
- cuenta = cuenta + 1
-
- lblDisplay.Text = acum * 3.785411784
- acum = 0
-
- lblDisplay.Text = acum / 3.785411784
- acum = 0
-
- xx = acum
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- lblDisplay.Text = "6"
- lblDisplay.Text = lblDisplay.Text & "6"
- cuenta = cuenta + 1
-
- lblDisplay.Text = acum * 0.45359237
- acum = 0
-
- lblDisplay.Text = acum / 0.45359237
- acum = 0
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- lblDisplay.Text = "7"
- lblDisplay.Text = lblDisplay.Text & "7"
-
- xx = acum
-
- cuenta = cuenta + 1
-
-
-
- lblDisplay.Text = "8"
- lblDisplay.Text = lblDisplay.Text & "8"
-
- xx = acum
-
- cuenta = cuenta + 1
-
-
-
- lblDisplay.Text = "9"
- lblDisplay.Text = lblDisplay.Text & "9"
-
- xx = acum
-
- cuenta = cuenta + 1
-
-
-
-
- lblDisplay.Text = "0"
- cuenta = 0
- acum = 0
-
- punto = False
- suma = False
- resta = False
- multiplica = False
- divide = False
- raiz = False
- segunda = False
- inv = False
-
- cmdINV.Background = &H808080
- cmd2nd.Background = &H808080
-
-
- mean = 0
- numdato = 0
- varianza = 0
- sdev = 0
- mem1 = 0
- cuenta = 0
-
- dato[ii] = 0
-
- grad = False
-
- lblDisplay.Text = "0"
- lblgrados.Caption = "DEG"
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
- cuenta = 0
- suma = False
- lblDisplay.Text = acum
-
- acum = xx + acum
- lblDisplay.Text = acum
- acum = 0
- xx = 0
- yy = 0
- porciento = False
-
- resta = False
- lblDisplay.Text = acum
-
- lblDisplay.Text = acum
-
- lblDisplay.Text = acum
- divide = False
- lblDisplay.Text = "Error"
-
- lblDisplay.Text = acum
- multiplica = False
-
- acum = acum ^ (1 / tempo1)
- lblDisplay.Text = acum
- tempo1 = 0
- acum = 0
-
- acum = (yy * 100 / xx) - 100
- lblDisplay.Text = acum
- acum = 0
- xx = 0
- yy = 0
- porciento = False
-
- lblDisplay.Text = acum
- acum = 0
- xx = 0
- yy = 0
-
-
- punto = False
-
- grad = True
- lblgrados.Caption = "GRAD"
- segunda = False
-
- segunda = False
- cmd2nd.Background = &H808080
- potencia = False
- cmd2nd.Background = &H808080
-
-
- punto = False
- xx = acum
- suma = True
- cuenta = 0
-
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- punto = False
- resta = True
- cuenta = 0
-
-
- lblDisplay.Text = "0."
- punto = True
- lblDisplay.Text = lblDisplay.Text & "."
- punto = True
- cuenta = cuenta + 1
-
- lblgrados.Caption = "DEG"
- grad = False
-
- segunda = False
- cmd2nd.Background = &H808080
-
-
- fmemr = True
-
- fmeme = True
-
- fmemr = True
-
- fmeme = True
-
-
-
-
- xx = xx * 0.01
- lblDisplay.Text = xx
- porciento = True
-
- yy = xx * yy * 0.01
- lblDisplay.Text = yy
- porciento = True
-
- deltaporc = True
- cuenta = 0
-
- punto = False
- segunda = False
- cmd2nd.Background = &H808080
-
-
-
-
-
-
-
-
-
-
- lblDisplay.Text = acum
-
- valor = 0
- tempo1 = 0
- lblDisplay.Text = "Error"
- valor = 0
- tempo1 = 0
-
-
-
-
-
- inv = False
- cmdINV.Background = &H808080
- segunda = False
- cmd2nd.Background = &H808080
-
-
- 'mem = Val(lblDisplay.Text)
- fmemw = True
-
- fixes = True
-
-
![[Imagen: BXmpCA0.png]](https://i.imgur.com/BXmpCA0.png)
Espero que haya entusiastas que les llame la atención este proyecto....Saludos.
Es mejor saber un poco de todo, que todo de muy poco. Lo primero, garantiza la supervivencia humana.