For cntr = 1 to 8
Rotate var1 Right Simple
If Status.C ON Then
var2.1 = 1
Else
var2.1 = 0
End if
Rotate var2 Right Simple
Next
Rotate var2 Right Simple
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems to me that you are attempting to use the syntax from another compiler with Great Cow Basic. May I suggest that you take the time to look at the sample code in GCB Help as well as in the demos to get a feel for GCB syntax.
Also if you comment your code might have a better idea what the code is trying to do.
I apologize to you. I'm an idiot, in the copy operation paste, I have tied up like a cat with a ball of wool.
My idea was to use the bits of a variable without using the "rotate" instruction,
an indexed manner,. In other Basic, i use a variable and then.. I can access a number of bits in this variable "var1 (index)" using a variable index.
I read a word data from a serial device, this device gives me mixed 16-bit information I want to test individually or distribute in another variables.
I'm reading the input port and heading to the variable containing the data sequentially, when I finished reading all the data, check a few bits within that data without having to rotate the whole thing only I access a portion of the data collected because the rest I'm not interested
dim va1,var2 , var3 as word
dim cntr1 as byte * this is de index
**----- * i was generated de previous protocol in the port
for cntr1=0 to 15
set clock_port on
wait 10 us
set clock_port off
wait 5 us
var1(cntr1) = port_input_serial_data_bit * any port bit
next
for cntr1=10 to 15
var2(cntr1)=var1(cntr1-10) ** i copied the bit 0 to 5 of the var1 to the bits 10 to 15
next
for cntr1 0 to 4
var3(cntr1)=var1(cntr1+5) ** i copied another bits in another variable
next
I know there are other ways to do it but for me, this is the most useful
I appreciate your patience.
Last edit: Manuel 2016-10-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First I need to correct my previous code, don't know what I was thinking with starting the rotation on the var2.1 bit, or course it starts with the var2.0 bit.
For cntr = 1 to 8
Rotate var1 Right Simple
If Status.C ON Then
var2.0 = 1
Else
var2.0 = 0
End if
Rotate var2 Right Simple
Next
Secondly, does this other compiler not have array type of variable? or a different type of syntax than GCB has for an array? Anyway bit equates seem to work
Hi friends
In another compiler could do this:
dim var1, var2 as byte
cntr1 dim as byte
255 var1 =
var2 = 0
for cntr1 = 0 to 7
var2 (cntr1) = var1 (cntr1)
next
output:
var1 ==> 255
var2 ==> 255
In this I can not do that, you know any procedure to do?
Arrays need to be dimensioned with GCB; See arrays and variable operations in Help. Also syntax mistakes:
EDIT: beg your pardon, I see what you are saying now. not sure.
Last edit: kent_twt4 2016-10-02
O.K. look for rotate to do the job, like so:
It seems to me that you are attempting to use the syntax from another compiler with Great Cow Basic. May I suggest that you take the time to look at the sample code in GCB Help as well as in the demos to get a feel for GCB syntax.
Also if you comment your code might have a better idea what the code is trying to do.
I apologize to you. I'm an idiot, in the copy operation paste, I have tied up like a cat with a ball of wool.
My idea was to use the bits of a variable without using the "rotate" instruction,
an indexed manner,. In other Basic, i use a variable and then.. I can access a number of bits in this variable "var1 (index)" using a variable index.
I read a word data from a serial device, this device gives me mixed 16-bit information I want to test individually or distribute in another variables.
I'm reading the input port and heading to the variable containing the data sequentially, when I finished reading all the data, check a few bits within that data without having to rotate the whole thing only I access a portion of the data collected because the rest I'm not interested
dim va1,var2 , var3 as word
dim cntr1 as byte * this is de index
**----- * i was generated de previous protocol in the port
for cntr1=0 to 15
set clock_port on
wait 10 us
set clock_port off
wait 5 us
var1(cntr1) = port_input_serial_data_bit * any port bit
next
for cntr1=10 to 15
var2(cntr1)=var1(cntr1-10) ** i copied the bit 0 to 5 of the var1 to the bits 10 to 15
next
for cntr1 0 to 4
var3(cntr1)=var1(cntr1+5) ** i copied another bits in another variable
next
I know there are other ways to do it but for me, this is the most useful
I appreciate your patience.
Last edit: Manuel 2016-10-02
First I need to correct my previous code, don't know what I was thinking with starting the rotation on the var2.1 bit, or course it starts with the var2.0 bit.
Secondly, does this other compiler not have array type of variable? or a different type of syntax than GCB has for an array? Anyway bit equates seem to work