Society of Robots - Robot Forum
General Misc => Misc => Topic started by: TrickyNekro on March 01, 2009, 06:59:24 AM
-
Hello guys,
anyone know how do I do this
' --------[ Device Config]----------------------------------------------------
$regfile = "m8def.dat"
$crystal = 16000000
$baud = 19200
' --------[ Variable Config ]-------------------------------------------------
Dim Voltage As Word
Dim Currentsum As Word
Dim Current1 As Word
Dim Current2 As Word
' --------[ Costant Config ]--------------------------------------------------
Const Cut_volt = 9000
' --------[ General Port Config ]---------------------------------------------
Config Portd.4 = Output
' Kill switch enable
Config Portb.1 = Output
' Buzzer circuit
' --------[ Timer Config ]----------------------------------------------------
' Timer1 Register A
Tccr1a = &B00000000
' Normal Port Operation
' Timer1 Register B
Tccr1b = &B00001011
' Timer set to CTC mode
' Prescaler at 64
' ORC1A
Compare1a = 100
' Produces a 1237,62Hz frequncy
' for the buzzer
' --------[ ADC config ]------------------------------------------------------
' ADC status register
Adcsra = &B11000111
' ADC started
' First Convertion also started
' Cause we have a 16MHz clock
' we setted the prescaler to
' 128 so the ADC clock is < 200KHz
Admux = &B00000000
' External reference is applied
' Convertion data are shown right wise
' ADC channel setted to 0, but this
' is just done for setting the ADMUX register
' changes in the process
' --------[ Initialize ]------------------------------------------------------
Portb.1 = 1
' Turn off the buzzer circuit to save energy
Portd.4 = 0
' The Kill switch is off, letting the button here terminates start up
Wait 1
' Wait some time, so the user is aware that he turns on the circuit
' and no brown out reset turns the circuit back on
Tccr1a = &B01000000
' Send some oscilations to the buzzer
Waitms 200
' for some time
Tccr1a = &B00000000
' then cut the buzzer and
Portd.4 = 1
' enable the supply permenately
Voltage = 0
' Set the variable
Voltage = Getadc(0)
' Start a convertion and get the voltage
Voltage = Voltage * 13
Voltage = Voltage + 100
' Do the math so the numbers are familiar with
' human being
' Check voltage
If Voltage < Cut_volt Then
' if the voltage is lower than acceptable ( 9V0 )
' then
Tccr1a = &B01000000
Waitms 100
Tccr1a = &B00000000
Waitms 100
Tccr1a = &B01000000
Waitms 100
Tccr1a = &B00000000
Waitms 100
' warn the user and
Portd.4 = 0
' kill the circuit to save the battery
End If
' --------[ Main ]------------------------------------------------------------
Main:
Do
Voltage = Getadc(0)
' Start a convertion and get the voltage
Voltage = Voltage * 13
If Voltage <> 0 Then
Voltage = Voltage + 100
End If
' Do the math so the numbers are familiar with
' human being
Print Voltage ; " " ; Chr(13);
' Send data to UART
Loop Until Voltage < Cut_volt
' if the condition is bridged then
Tccr1a = &B01000000
Waitms 100
Tccr1a = &B00000000
Waitms 100
Tccr1a = &B01000000
Waitms 100
Tccr1a = &B00000000
Wait 5
' warn the user and
Portd.4 = 0
' kill the circuit to save the battery
End
And Hey Admin!!! Still.... nothing on that tutorial... it doesn't show up at the tutorial page... So I might need your help....
-
have you tried typing:
[ code ] without spaces and to stop writing code:
[ / code ]
like this on the tutorial page?
-
That [ code ] thing only works on forums, not the member pages.
-
Yup.... Just secs, before I replied....
Member pages accept only HTML code... I think that I should frame the text somehow....
but....... how???
Regards, Lefteris
Greece
-
you could create a html box and add a title to it then html colour it in but unfortunately, i have forgot how to write html seeing as its so long ago since i did it. :(
-
I did it on my halfly finished tutorial, but then Admin unpublished it and I have no way to see how I did it. >:(
Try this:
<pre>
code here
</pre>
-
Nice!!!
Bad thing I can not scroll the text just like the forum....
But still it makes a difference and that's good!!!
-
have you tried just putting it into a html table like this
<table bgcolor="#FFFFFF" border="1">
<tr>
<td>
//insert cod here
</td>
</tr>
</table>
the bgcolor="" can hav any #color inserted for the background.
If you want scrollable then just add a textarea
<textarea width="800" height="500">
//code here
</textarea>