How can I post formatted code?
Submitted By: Jan Waclawek FAQ Last Modified: 09/05/06
- Enclose the code into <pre> and </pre> tags.
For example, if you type:
X0: cpl Pin ;toggle LED state mov r2,#Timing ;load timing value X1: djnz r0,X1 ;timing done by simple nested loops djnz r1,X1 ; - not precise, but good for blinkey djnz r2,X1 sjmp X0 endthe resulting post will look like this:
X0: cpl Pin ;toggle LED state
mov r2,#Timing ;load timing value
X1: djnz r0,X1 ;timing done by simple nested loops
djnz r1,X1 ; - not precise, but good for blinkey
djnz r2,X1
sjmp X0
end
But if you type:
<pre> X0: cpl Pin ;toggle LED state mov r2,#Timing ;load timing value X1: djnz r0,X1 ;timing done by simple nested loops djnz r1,X1 ; - not precise, but good for blinkey djnz r2,X1 sjmp X0 end </pre>the resulting post will be nicely formatted:
X0: cpl Pin ;toggle LED state mov r2,#Timing ;load timing value X1: djnz r0,X1 ;timing done by simple nested loops djnz r1,X1 ; - not precise, but good for blinkey djnz r2,X1 sjmp X0 end
A similar description can be found also in Jon Ledbetters "The noob's guide to 8052.com".
How can I preserve syntax colouring and indents?
Submitted By: Jez Smith FAQ Last Modified: 09/05/06
- When posting code in higher level languages such as C it makes the posted code more readable if the code is syntax colour coded and the indentations are preserved, an easy and free way to do this is by use of (g)vim, available for download at http://www.vim.org a free and perhaps the most popular vi-alike available. using (g)vim it is easy to automaticaly produce html code which can be cut and pasted into the message text which will preserve the syntax colouring and the indentations of your nicely formated code.
How can I post formatted code?
Submitted By: Andy Neil FAQ Last Modified: 09/05/06
- Note:
Do not use TAB characters to lay out code when posting to the forum - use only spaces.
(this is because you have no control of how other people's browsers may interpret TAB characters).
The same applies to ASCII-Art?
Submitted By: Andy Neil FAQ Last Modified: 09/05/06
Jan Waclawek said:
Enclose the code into <pre> and </pre> tags.
The same applies to "ASCII-Art" - ie, trying to draw diagams using only ASCII characters.
For example, if you type:
----------------- -------------------------- microcontroller | | ST16C554 UART side | | side /R |------------------|/IOR /W |------------------|/IOW | | ------------------- ---------------------------the resulting post will look like this:
----------------- --------------------------
microcontroller | | ST16C554 UART
side | | side
/R |------------------|/IOR
/W |------------------|/IOW
| |
------------------- ---------------------------
But if you type:
<pre>
----------------- -------------------------- microcontroller | | ST16C554 UART side | | side /R |------------------|/IOR /W |------------------|/IOW | | ------------------- ---------------------------</pre>
the resulting post will be nicely formatted:
----------------- -------------------------- microcontroller | | ST16C554 UART side | | side /R |------------------|/IOR /W |------------------|/IOW | | ------------------- ---------------------------
A similar description can be found also in Jon Ledbetters "The noob's guide to 8052.com".
Add Information to this FAQ: If you have additional information or alternative solutions to this question, you may add to this FAQ by clicking here.