Loading ...
Sorry, an error occurred while loading the content.

arrays and bits

Expand Messages
  • Alessandro Zummo
    Hi jallians, i need some comments about the best way to do the following: first, i ve to setup an array... i readed the jal s FAQ, but i was unable to find any
    Message 1 of 11 , Jul 1, 2000
    • 0 Attachment
      Hi jallians,

      i need some comments about the best way to do the following:

      first, i've to setup an array... i readed the jal's FAQ, but i
      was unable to find any info about mem_get and mem_put.

      Then, i have to access the array sequentially, both in reading
      and in writing.

      While accessing it, i need to test arbitrary bits of the currently
      selected byte (read: i don't want to hardcode the bit number).

      Any suggestion? :-)

      --

      - az -
    • w. v. ooijen / f. hanneman
      ... Assuming you are using an 16x84 mem_get and mem_put are trivial. But Jal does not support arrays, so you ll have to make that yourself. I think the easiest
      Message 2 of 11 , Jul 1, 2000
      • 0 Attachment
        > first, i've to setup an array... i readed the jal's FAQ, but i
        > was unable to find any info about mem_get and mem_put.

        Assuming you are using an 16x84 mem_get and mem_put are trivial. But Jal
        does not support arrays, so you'll have to make that yourself. I think the
        easiest way is to look at the assembler output and no the highest variable
        address used there. Start you array beyond that (and remeber to look again
        when you change your program!). The other way is to declare a number of
        global variables, use the first as start of the array, and use pragma keep
        to prevent the compiler from optimizing them away. I know this is not
        simple, but untill I have added real arrays it seems the best way.

        > While accessing it, i need to test arbitrary bits of the currently
        > selected byte (read: i don't want to hardcode the bit number).

        To get bit N (0=LSB, 7=MSB) from a byte B you could use (typed from my
        head, so errors are included for free):

        function bit_n_from_b( byte in n, byte in b ) return bit is
        var byte x
        var bit r at x : 0
        x = b >> n
        return r
        end function

        Wouter
      • Rob Curtis
        I have code to implement a stack and an arbitrary length array. It is tested and working. Email me if you would like it. Rob Curtis ... From: Alessandro Zummo
        Message 3 of 11 , Jul 1, 2000
        • 0 Attachment
          I have code to implement a stack and an arbitrary length array. It is
          tested and working. Email me if you would like it.

          Rob Curtis
          -----Original Message-----
          From: Alessandro Zummo [mailto:azummo@...]
          Sent: Saturday, July 01, 2000 22:15
          To: jallist@egroups.com
          Subject: [jallist] arrays and bits



          Hi jallians,

          i need some comments about the best way to do the following:

          first, i've to setup an array... i readed the jal's FAQ, but i
          was unable to find any info about mem_get and mem_put.

          Then, i have to access the array sequentially, both in reading
          and in writing.

          While accessing it, i need to test arbitrary bits of the currently
          selected byte (read: i don't want to hardcode the bit number).

          Any suggestion? :-)

          --

          - az -



          ------------------------------------------------------------------------
          10% off Windows 2000 or Linux Certification training!

          Be one of the first 5000 people to visit
          http://www.cyberstateu.com/partner/info.html.
          Fill out the form for more info and you will receive a 10% discount on
          Windows 2000 or Linux training and the chance to win free training.
          http://click.egroups.com/1/5933/5/_/5710/_/962455708/
          ------------------------------------------------------------------------
        • w. v. ooijen / f. hanneman
          ... Why not post it to the list (so James can pick it up and put it on the Jal code/resources page)? Wouter
          Message 4 of 11 , Jul 2, 2000
          • 0 Attachment
            > I have code to implement a stack and an arbitrary length array. It is
            > tested and working. Email me if you would like it.

            Why not post it to the list (so James can pick it up and put it on the Jal
            code/resources page)?

            Wouter
          • Alessandro Zummo
            ... Sorry, I m still missing the point.. are the routines available somewhere o i ve to code them myself? ... This one seems to be more secure :-) ... thanks.
            Message 5 of 11 , Jul 2, 2000
            • 0 Attachment
              On 01-Lug-00, w. v. ooijen / f. hanneman wrote:

              >> first, i've to setup an array... i readed the jal's FAQ, but i
              >> was unable to find any info about mem_get and mem_put.

              > Assuming you are using an 16x84 mem_get and mem_put are trivial. But Jal
              > does not support arrays, so you'll have to make that yourself. I think the

              Sorry, I'm still missing the point.. are the routines available somewhere o i've
              to code them myself?

              > when you change your program!). The other way is to declare a number of
              > global variables, use the first as start of the array, and use pragma keep

              This one seems to be more secure :-)

              >> While accessing it, i need to test arbitrary bits of the currently
              >> selected byte (read: i don't want to hardcode the bit number).

              > To get bit N (0=LSB, 7=MSB) from a byte B you could use (typed from my
              > head, so errors are included for free):

              > function bit_n_from_b( byte in n, byte in b ) return bit is

              thanks. Will this be implemented directly in JAL? A syntax
              like the usual x : n would be fine.

              > ------------------------------------------------------------------------
              > 10% off Windows 2000 or Linux Certification training!

              :-)

              --

              - az -
            • Rob Curtis
              Because then you ll all poke fun at my code. 8) Rob ... From: w. v. ooijen / f. hanneman [mailto:wf@xs4all.nl] Sent: Sunday, July 02, 2000 17:35 To:
              Message 6 of 11 , Jul 2, 2000
              • 0 Attachment
                Because then you'll all poke fun at my code. 8)

                Rob

                -----Original Message-----
                From: w. v. ooijen / f. hanneman [mailto:wf@...]
                Sent: Sunday, July 02, 2000 17:35
                To: jallist@egroups.com
                Subject: Re: [jallist] arrays and bits


                > I have code to implement a stack and an arbitrary length array. It is
                > tested and working. Email me if you would like it.

                Why not post it to the list (so James can pick it up and put it on the Jal
                code/resources page)?

                Wouter

                ------------------------------------------------------------------------
                10% off Windows 2000 or Linux Certification training!

                Be one of the first 5000 people to visit
                http://www.cyberstateu.com/partner/info.html.
                Fill out the form for more info and you will receive a 10% discount on
                Windows 2000 or Linux training and the chance to win free training.
                http://click.egroups.com/1/5933/5/_/5710/_/962552501/
                ------------------------------------------------------------------------
              • w. v. ooijen / f. hanneman
                ... Shit, that is exactly the fear that prevents a healty sharing of code. Please please step over it and share your code! If I had the same fear there would
                Message 7 of 11 , Jul 2, 2000
                • 0 Attachment
                  > Because then you'll all poke fun at my code. 8)
                  Shit, that is exactly the fear that prevents a healty sharing of code.
                  Please please step over it and share your code! If I had the same fear
                  there would not be a Jal at all and certainly no Jal libraries....
                  Wouter
                • James Michael Newton
                  Thank you. Posted to the http://www.piclist.com/jal library. I m still watching for that stack and an arbitrary length array from Rob.... ... James Newton
                  Message 8 of 11 , Jul 6, 2000
                  • 0 Attachment
                    Thank you. Posted to the http://www.piclist.com/jal library.

                    I'm still watching for that "stack and an arbitrary length array" from
                    Rob....

                    ...and I promise not to make fun of it. <GRIN>

                    ---
                    James Newton (PICList Admin #3)
                    mailto:jamesnewton@... 1-619-652-0593
                    PIC/PICList FAQ: http://www.piclist.com or .org

                    -----Original Message-----
                    From: w. v. ooijen / f. hanneman [mailto:wf@...]
                    Sent: Saturday, July 01, 2000 13:57
                    To: jallist@egroups.com
                    Subject: Re: [jallist] arrays and bits


                    > first, i've to setup an array... i readed the jal's FAQ, but i
                    > was unable to find any info about mem_get and mem_put.

                    Assuming you are using an 16x84 mem_get and mem_put are trivial. But Jal
                    does not support arrays, so you'll have to make that yourself. I think the
                    easiest way is to look at the assembler output and no the highest variable
                    address used there. Start you array beyond that (and remeber to look again
                    when you change your program!). The other way is to declare a number of
                    global variables, use the first as start of the array, and use pragma keep
                    to prevent the compiler from optimizing them away. I know this is not
                    simple, but untill I have added real arrays it seems the best way.

                    > While accessing it, i need to test arbitrary bits of the currently
                    > selected byte (read: i don't want to hardcode the bit number).

                    To get bit N (0=LSB, 7=MSB) from a byte B you could use (typed from my
                    head, so errors are included for free):

                    function bit_n_from_b( byte in n, byte in b ) return bit is
                    var byte x
                    var bit r at x : 0
                    x = b >> n
                    return r
                    end function

                    Wouter


                    ------------------------------------------------------------------------
                    10% off Windows 2000 or Linux Certification training!

                    Be one of the first 5000 people to visit
                    http://www.cyberstateu.com/partner/info.html.
                    Fill out the form for more info and you will receive a 10% discount on
                    Windows 2000 or Linux training and the chance to win free training.
                    http://click.egroups.com/1/5933/5/_/5710/_/962524739/
                    ------------------------------------------------------------------------
                  • Rob Curtis
                    Sorry, Rob s been flat out but he promises to send it in the morning. (I don t know what time that amounts to over there in the civilized world 8) I would
                    Message 9 of 11 , Jul 6, 2000
                    • 0 Attachment
                      Sorry, Rob's been flat out but he promises to send it in the morning.
                      (I don't know what time that amounts to over there in the civilized world 8)

                      I would really love to see relative addressing & pointers but you find that
                      if you can make an
                      array, you can build anything from a directed graph to a binary tree.

                      Rob
                      -----Original Message-----
                      From: James Michael Newton [mailto:jamesmichaelnewton@...]
                      Sent: Thursday, July 06, 2000 23:18
                      To: jallist@egroups.com
                      Subject: RE: [jallist] arrays and bits


                      Thank you. Posted to the http://www.piclist.com/jal library.

                      I'm still watching for that "stack and an arbitrary length array" from
                      Rob....

                      ...and I promise not to make fun of it. <GRIN>
                    • Snail Instruments
                      ... Well, these words are used more frequently on a PC. PIC resources are limited in terms of data RAM, program space and also quite inefficient indirect
                      Message 10 of 11 , Jul 7, 2000
                      • 0 Attachment
                        >I would really love to see relative addressing & pointers but you find that
                        >if you can make an
                        >array, you can build anything from a directed graph to a binary tree.

                        Well, these words are used more frequently on a PC. PIC resources are
                        limited in terms of data RAM, program space and also quite inefficient
                        indirect addressing. You may need to tweak your algorithms to 'bare bones'
                        to fit PIC better.

                        Josef


                        =======================================================================
                        Electronical devices for chemical laboratory, custom electronics design
                        -----------------------------------------------------------------------
                        Snail Instruments Josef Hanzal, M. S.
                        Vojanova 615 phone/fax: +420-311-624433
                        266 01 Beroun e-mail: snail@...
                        Czech Republic URL: http://www.vitrum.cz/snail/
                        GPS: 49deg58'28" North, 14deg 4'35" East
                        =======================================================================
                      • vasile@l30.itim-cj.ro
                        ... Rob, If I remember well you gave me some time ago an interesting solution for my PWM problems. That code show ( to me ) you coquete too much with software,
                        Message 11 of 11 , Jul 17, 2000
                        • 0 Attachment
                          On 3 Jul 00, at 12:04, Rob Curtis wrote:

                          > Because then you'll all poke fun at my code. 8)

                          Rob,
                          If I remember well you gave me some time ago an interesting
                          solution for my PWM problems.
                          That code show ( to me ) you coquete too much with software,
                          more than myself. So I'm very curious to see your code !
                          If you have fun with my for_next loops for multiplication why not
                          some "poke fun" ?... it's healthy for all !
                          Look for your code on jal page!

                          *********************************************
                          Surducan Vasile
                          mail: vasile@...-cj.ro
                          URL: http://www.geocities.com/vsurducan
                          *********************************************
                        Your message has been successfully submitted and would be delivered to recipients shortly.