View previous topic :: View next topic |
Author |
Message |
atmega8
Joined: 17 Apr 2015 Posts: 2
|
Posted: Sat Apr 18, 2015 12:10 am Post subject: digital source |
|
|
hi
best regard
fellow forum
come to you if I can you please help me fix this program developed in bascom avr is small but it is not compiling.
this is the program
$ Regfile = "m8def.dat"
$ Crystal = 4000000
Config Lcd = 16 * 2
Config Lcdbus = 4
Config LcdPin = Pin, Db4 = PORTB.0, Db5 = PORTB.1, Db6 = Portb.2, Db7 = PORTB.3, Rs = Portb.4, E = Portb.5
As Single Dim Volt
As Single Dim Volt1
As String Dim V * 4
Dim Word As Aux1
Config Adc = Single, Prescaler = Auto, Reference = AVCC 'configure ADC
Start Adc
Do
Cls
Locate 1, 1
Lcd "Power Supply"
Aux1 = GetADC (0)
Volt = Aux1 * 5
Volt = Volt / 1024
Volt1 = Volt * 4
V = Fusing (volt1), "Round decimals of a single data type and transforms it into string"
Locate 2, 1
Lcd "Vdc ="; V; "V"
WAITMS 600
Loop
with the help of you to see where this error and to correct it.
This program basically does the following.
I built a power supply of 14 Vdc at 1A including the LM317 and 7805 to power the microcontroller avr atmega8 and display 16x2, I used the adc of atmega8 to enter the pin 24 voltage from the voltage divider source 4 10k resistors in parallel and displayed by the LCD voltage when turning the potentiometer, and not have to use the multimeter to display the voltage.
This is a project for my digital electronics class university, practically I have nearly finished project so come to you if I can you please help me correct the program, I would appreciate.
jose luis commas llinas
medellin-colombia |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Apr 21, 2015 3:27 pm Post subject: |
|
|
Have a look at the code and the differences with yours.
Code: | $Regfile = "m8def.dat"
$Crystal = 4000000
Config Lcd = 16 * 2
Config LcdPin = Pin, Db4 = PORTB.0, Db5 = PORTB.1, Db6 = Portb.2, Db7 = PORTB.3, Rs = Portb.4, E = Portb.5
Dim Volt As Single,Volt1 As Single, V as string * 4, Aux1 as word
Config Adc = Single, Prescaler = Auto, Reference = AVCC 'configure ADC
Start Adc
Do
Cls: Locate 1, 1: Lcd "Power Supply"
Aux1 = GetADC (0)
Volt = Aux1 * 5
Volt = Volt / 1024
Volt1 = Volt * 4
V = Fusing (volt1,"##.#") ' "Round decimals of a single data type and transforms it into string"
Locate 2, 1 : Lcd "Vdc ="; V ; "V"
WAITMS 600
Loop |
_________________ Mark |
|
Back to top |
|
|
atmega8
Joined: 17 Apr 2015 Posts: 2
|
Posted: Tue Apr 21, 2015 4:21 pm Post subject: |
|
|
hi
thanks for the help I send the image source circuit, but when I turn the potentiometer font only displays me a voltage of 20 Vdc, the source has a voltage divider with 4 resistors 10k and gnd to enter the Adc the atmega 8 pin 23, the purpose of this project is to use the Avr micro Adc.
example
when turning the potentiometer Supply voltage 10VDC this same voltage should appear on the display lcd 16 * 2, the display is seeing a very different voltage 20Vcd, appreciate you help me again for my class project.
thanks
jose luis |
|
Back to top |
|
|
|
|
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 You cannot attach files in this forum You cannot download files in this forum
|
|