7
\$\begingroup\$

I've seen in a lot of projects a cool presentation of byte such as :

      Fuse high byte:  
      0xc9 = 1 1 0 0   1 0 0 1 -- BOOTRST (boot reset vector at 0x0000)  
             ^ ^ ^ ^   ^ ^ ^------ BOOTSZ0  
             | | | |   | +-------- BOOTSZ1  
             | | | |   + --------- EESAVE (don't preserve EEPROM over chip erase)  
             | | | +-------------- CKOPT (full output swing)  
             | | +---------------- SPIEN (allow serial programming)  
             | +------------------ WDTON (WDT not always on)  
            +-------------------- RSTDISBL (reset pin is enabled)  

or

    Fuse low byte:
     0x9f = 1 0 0 1   1 1 1 1
            ^ ^ \ /   \--+--/
            | |  |       +------- CKSEL 3..0 (external >8M crystal)
            | |  +--------------- SUT 1..0 (crystal osc, BOD enabled)
            | +------------------ BODEN (BrownOut Detector enabled)
            +-------------------- BODLEVEL (2.7V)

I wonder if anyone can tell me how, or where, I can make some of these ?

edit : I mean, I often see those type of presentation in texte format, so I suppose it isen't made by hand. I was hopping to find the software/url to generate the samme.

\$\endgroup\$
3
  • \$\begingroup\$ If you surround text in <pre> tags, it won't attempt to syntax highlight it, but it (should) still be monospace. \$\endgroup\$ Commented Sep 15, 2010 at 14:22
  • 10
    \$\begingroup\$ They are usually done by hand, seriously. :) \$\endgroup\$
    – bjarkef
    Commented Sep 16, 2010 at 16:25
  • \$\begingroup\$ I've always made them by hand, and have made probably hundreds of the damn things. Really not tricky at all. \$\endgroup\$
    – akohlsmith
    Commented May 31, 2012 at 22:02

6 Answers 6

5
\$\begingroup\$

You can play with something with graphviz and dot. Those are the tools doxygen uses to create the diagrams. It is not exactly what you are searching for, but it is fast and easy to script and the output is kind of nice looking (even thou it is a little hard to follow some lines...)


This example will generate something like this

alt text

To do this you first create a file called byte.dot

digraph structs { 
node [shape=plaintext] 

struct1 [label=< 
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" ALIGN="left">  
    <TR>
        <TD>0xc9</TD>
        <TD PORT="f0"> 1 </TD>
        <TD PORT="f1"> 1 </TD>
        <TD PORT="f2"> 0 </TD>
        <TD PORT="f3"> 0 </TD>

        <TD PORT="f4"> 1 </TD>
        <TD PORT="f5"> 0 </TD>
        <TD PORT="f6"> 0 </TD>
        <TD PORT="f7"> 1 </TD>
    </TR> 
</TABLE>>]; 

struct2 [label=< 
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" >  
    <TR> <TD ALIGN="left" PORT="f0"> RSTDISBL (reset pin is enabled) </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f1"> WDTON (WDT not always on) </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f2"> SPIEN (allow serial programming)  </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f3"> CKOPT (full output swing) </TD> </TR>

    <TR> <TD ALIGN="left" PORT="f4"> EESAVE (don't preserve EEPROM over chip erase)  </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f5"> BOOTSZ1 </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f6"> BOOTSZ0 </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f7"> BOOTRST (boot reset vector at 0x0000) </TD> </TR>
</TABLE>>]; 

struct1:f0:s -> struct2:f0:w;
struct1:f1:s -> struct2:f1:w;
struct1:f2:s -> struct2:f2:w; 
struct1:f3:s -> struct2:f3:w;

struct1:f4:s -> struct2:f4:w;
struct1:f5:s -> struct2:f5:w;
struct1:f6:s -> struct2:f6:w; 
struct1:f7:s -> struct2:f7:w;
} 

Then run one of those commands.

dot -Tpng byte.dot -o byte.png 
dot -Tps  byte.dot -o byte.ps

Maybe it will be nicer if we do not cross all the lines in the middle?

alt text

I just switched the named in the second table from f0..f7 into f7..f0.

<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" >
    <TR> <TD ALIGN="left" PORT="f7"> RSTDISBL (reset pin is enabled) </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f6"> WDTON (WDT not always on) </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f5"> SPIEN (allow serial programming)  </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f4"> CKOPT (full output swing) </TD> </TR>

    <TR> <TD ALIGN="left" PORT="f3"> EESAVE (don't preserve EEPROM over chip erase)  </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f2"> BOOTSZ1 </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f1"> BOOTSZ0 </TD> </TR>
    <TR> <TD ALIGN="left" PORT="f0"> BOOTRST (boot reset vector at 0x0000) </TD> </TR>
</TABLE>>];
\$\endgroup\$
5
\$\begingroup\$

That's a rather tedius way to show the fields in a binary number. Here is a snippet from actual source code that shows how I do it:

         setreg  b'00010000', eccp1as
                 ; 0-------  clear any existing shutdown event
                 ; -001----  shut down PWM on comparator 1 high
                 ; ----00--  P1A and P1C shutdown state is low
                 ; ------00  P1B and P1D shutdown state is low

         setreg  b'10000000', pwm1con
                 ; 1-------  auto restart once shutdown condition goes away
                 ; -0000000  no restart delay

         setreg  b'00000001', pstrcon
                 ; XXX-----  unused
                 ; ---0----  output pin steering takes effect immediately
                 ; ----0---  P1D pin not driven, has normal port function
                 ; -----0--  P1C pin not driven, has normal port function
                 ; ------0-  P1B pin not driven, has normal port function
                 ; -------1  P1A pin drive from PWM signal

I think this is easier than your elaborate example, but still shows the same information. Yes, I really do write code like this.

\$\endgroup\$
4
\$\begingroup\$

In your favourite text editor. I can recommend vim.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ That's exactly what I do... I don't really understand this question. :-) \$\endgroup\$
    – akohlsmith
    Commented Sep 15, 2010 at 14:23
  • \$\begingroup\$ I also suggest that these are done by hand, like all proper AA. :) \$\endgroup\$
    – XTL
    Commented Sep 16, 2010 at 10:01
2
\$\begingroup\$

You could use Gliffy, an online package similar to Visio. I knocked out some of your diagram in about two minutes: http://www.gliffy.com/pubdoc/2237997/L.png

\$\endgroup\$
1
\$\begingroup\$

In the editor of Dos Navigator there is a special draw mode. You can enable double line drawing by pressing F4, then F4 again for single line, and again to disable. You can easily draw lines with the cursor keys while holding the shift key.

1 1 0 0   1 1 0 0 ───────┬┐
│ │   ║       ║ │        │├───────┐
│ │   ║       ║ └────────┴┘       │
│ │   ║       ║                   │
│ │   ║       ║                   │
│ │   ║       ║                   │
│ │   ║       ╚═════════════╗     │
│ │   ╚═════════════════════╝     │
│ │                               │
│ │                               │
│ └───────────────────────┬┐     ┌┘
│                 ┌┬┐┌┐  ┌┘└┐   ┌┘
└───────────────┐┌┤│││└┐┌┘  └┐ ┌┘
                └┘└┘└┘ └┘    └─┘
\$\endgroup\$
1
  • 2
    \$\begingroup\$ Emacs Artist mode does that sort of thing too, without resorting to non-ASCII symbols. I still simply type these things, though overwrite, free placement and repetition commands can help. \$\endgroup\$ Commented Oct 16, 2010 at 13:36
0
\$\begingroup\$

ditaa does what your'e looking for. The following image is generated from your raw text above.

alt text

Might need a bit of editing to get the formatting right...

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Know what? This isn't what the OP is looking for, despite its coolness. He wants something that will generate ASCII art for him... I can't downvote my own post... \$\endgroup\$
    – J. Polfer
    Commented Dec 10, 2010 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.