Hello and thanks for replying-
I bought dren compilers for PIC; AVR; PIC32; and ARM
I have problems with the compiler STM32 ARM ...
By using the conversion function in a subroutine the microcontroller and start running the program the microcontroller stops executing ...
Now if the function is executed in the main ... working properly ..
Example .... IntToStrWithZeros (adc_rd, TEXT) or
wordToStrWithZeros (adc_rd, TEXT) or
byteToStrWithZeros (adc_rd, TEXT)
conversion functions work not to be in a subroutine
the question is ...
why conversion functions do not work to be in a subroutine.??
The development board is a EasyMx PRO ™ v7 for STM32 microcontroller use and is a STM32F107VC
Thank poor respond
Problems comversion function
Re: Problems comversion function
Hi,
Please, can you attach here the minimal project that demonstrates this issue ?
Which version of the compiler are you using ?
Regards,
Filip.
Please, can you attach here the minimal project that demonstrates this issue ?
Which version of the compiler are you using ?
Regards,
Filip.
-
- Posts: 2
- Joined: 06 Sep 2011 04:48
Re: Problems comversion function
filip wrote:Hi,
Please, can you attach here the minimal project that demonstrates this issue ?
Which version of the compiler are you using ?
Regards,
Filip.
me_long = 1234
cant_displays = 2
prueba = 1
gosub funcion
gosub convierto 'Tengo el valor de me_long en ASCII
prueba = 0
LongIntToStrWithZeros(me_long, PP0) 'The function should place it in the main to work
gosub muestro_display
gosub muestreo 'Mando a displays lo que tengo en conversion
inc(variable)
if variable = 4 then
variable = 0
end if
wend
funcion:
return
convierto:
'LongIntToStrWithZeros(me_long, PEPE) ' If the function is executed at that position NOT WORKING
'ByteToStr(me_long, PEPE)
'PEPE[0] = "0"
for I = 0 to 8
PEPE = (me_long mod 10) + 48
me_long = me_long / 10
next i
return
muestro_display:
if PEPE[variable] = "2" then
salida0 = %01100000
salida1 = %01100000
else
salida0 = %11111100
salida1 = %11111100
end if
return
conversion: 'Entras con una variable contador y tira numeros de 00 a 99
if cant_displays >= 1 then 'En caso de tener 1 o mas displays
if counter = 10 then
counter = 0
inc(counter2)
end if
if cant_displays = 2 then 'En caso de tener 2 displays
if counter2 = 10 then
counter = 0
counter2 = 0
end if
end if
end if
if cant_displays >=1 then 'En caso de tener 1 o mas displays
select case counter
case 0
salida0 = %11111100
case 1
salida0 = %01100000
case 2
salida0 = %11011010
case 3
salida0 = %11110010
case 4
salida0 = %01100110
case 5
salida0 = %10110110
case 6
salida0 = %10111110
case 7
salida0 = %11100000
case 8
salida0 = %11111110
case 9
salida0 = %11110110
end select
if cant_displays = 2 then 'En caso de tener 2 displays
select case counter2
case 0
salida1 = %11111100
case 1
salida1 = %01100000
case 2
salida1 = %11011010
case 3
salida1 = %11110010
case 4
salida1 = %01100110
case 5
salida1 = %10110110
case 6
salida1 = %10111110
case 7
salida1 = %11100000
case 8
salida1 = %11111110
case 9
salida1 = %11110110
end select
end if
end if
return
muestreo:
if cant_displays >= 1 then 'En caso de tener 1 o mas displays
for i = 0 to 7
if (salida0 and 1) = 1 then
dato = 1
else
dato = 0
end if
clk = 1
Delay_ms(10)
clk = 0
Delay_ms(10)
salida0 = salida0 >> 1
next i
if cant_displays = 2 then 'En caso de tener 2 displays
for i = 0 to 7
if (salida1 and 1) = 1 then
dato = 1
else
dato = 0
end if
clk = 1
Delay_ms(10)
clk = 0
Delay_ms(10)
salida1 = salida1 >> 1
next i
end if
end if
strobe = 1
Delay_ms(10)
strobe = 0
Delay_ms(10)
return
end
************************************
If NOT understand the program will send the explanations ...
the function I use to write on a seven-segment display
I think the problem is how to generate the function ...
and serves as the stack pointer
Thank you!!
Ricardo Lavié
Buenos Aires Argentina
rc_lavie@yahoo.com