Society of Robots - Robot Forum

General Misc => Misc => Topic started by: TrickyNekro on March 01, 2009, 06:59:24 AM

Title: Tutorial page.... how to place code?????
Post by: TrickyNekro on March 01, 2009, 06:59:24 AM
Hello guys,
anyone know how do I do this
Code: [Select]
' --------[ 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....
Title: Re: Tutorial page.... how to place code?????
Post by: frodo on March 01, 2009, 09:43:11 AM
have you tried typing:
[ code ] without spaces and to stop writing code:
[ / code ]

Code: [Select]
like this on the tutorial page?
Title: Re: Tutorial page.... how to place code?????
Post by: Razor Concepts on March 01, 2009, 10:05:48 AM
That [ code ] thing only works on forums, not the member pages.
Title: Re: Tutorial page.... how to place code?????
Post by: TrickyNekro on March 01, 2009, 10:07:45 AM
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
Title: Re: Tutorial page.... how to place code?????
Post by: frodo on March 01, 2009, 10:10:49 AM
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. :(
Title: Re: Tutorial page.... how to place code?????
Post by: Trumpkin on March 01, 2009, 04:02:20 PM
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:
Code: [Select]
<pre>
code here
</pre>
Title: Re: Tutorial page.... how to place code?????
Post by: TrickyNekro on March 01, 2009, 05:09:32 PM
Nice!!!
Bad thing I can not scroll the text just like the forum....
But still it makes a difference and that's good!!!
Title: Re: Tutorial page.... how to place code?????
Post by: paulstreats on March 01, 2009, 07:32:00 PM
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>