Hey All,
I'm working on a project with a Dragon12 board running codewarrior
for the code. i'm trying to get position control of an arm connected to a
motor. I manged to get this done, but it kinda oscillates and so my professor
suggested i analyse the position values to get a proper proportional control
value. i'm trying to use SCI to get output my position error values so i
can plot them. could someone please suggest a good method to continuously output
the values say to a text file on my comp or as an array list in hyperterminal?
Thanks,
Nish
Dragon 12 SCI
Started by ●September 24, 2010
Reply by ●September 24, 20102010-09-24
In hyperterm
Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
A
On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> Hey All,
> I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
>
> Thanks,
> Nish
Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
A
On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> Hey All,
> I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
>
> Thanks,
> Nish
Reply by ●September 24, 20102010-09-24
How about using the two DAC:s to plot the position, error etc using some
recorder?
Regards,
Anders
> -----Original Message-----
> From: 6... [mailto:6...] On Behalf Of
> nishanth_r
> Sent: Friday, September 24, 2010 6:12 AM
> To: 6...
> Subject: [68HC12] Dragon 12 SCI
>
> Hey All,
> I'm working on a project with a Dragon12 board running codewarrior
for
> the code. i'm trying to get position control of an arm connected to a
motor. I
> manged to get this done, but it kinda oscillates and so my professor
suggested
> i analyse the position values to get a proper proportional control value.
i'm
> trying to use SCI to get output my position error values so i can plot
them.
> could someone please suggest a good method to continuously output the
values
> say to a text file on my comp or as an array list in hyperterminal?
>
> Thanks,
> Nish
>
>
recorder?
Regards,
Anders
> -----Original Message-----
> From: 6... [mailto:6...] On Behalf Of
> nishanth_r
> Sent: Friday, September 24, 2010 6:12 AM
> To: 6...
> Subject: [68HC12] Dragon 12 SCI
>
> Hey All,
> I'm working on a project with a Dragon12 board running codewarrior
for
> the code. i'm trying to get position control of an arm connected to a
motor. I
> manged to get this done, but it kinda oscillates and so my professor
suggested
> i analyse the position values to get a proper proportional control value.
i'm
> trying to use SCI to get output my position error values so i can plot
them.
> could someone please suggest a good method to continuously output the
values
> say to a text file on my comp or as an array list in hyperterminal?
>
> Thanks,
> Nish
>
>
Reply by ●September 24, 20102010-09-24
Hey Andrei,
Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
Thanks again,
Nish
--- In 6..., Andrei Chichak wrote:
>
> In hyperterm Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
>
> A
> On 2010-September-23, at 10:12 PM, nishanth_r wrote:
>
> > Hey All,
> > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> >
> > Thanks,
> > Nish
> >
> >
>
>
Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
Thanks again,
Nish
--- In 6..., Andrei Chichak wrote:
>
> In hyperterm Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
>
> A
> On 2010-September-23, at 10:12 PM, nishanth_r wrote:
>
> > Hey All,
> > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> >
> > Thanks,
> > Nish
> >
> >
>
>
Reply by ●September 24, 20102010-09-24
Hi Andrei,
Seems reasonable, but thats too complicated for me :) i was hoping for something simpler, like getting the data out and using matlab to plot the step response and get a proportional control value using zn step response :) i'm familiar with that :)
Nish
--- In 6..., "Anders Friberg" wrote:
>
> How about using the two DAC:s to plot the position, error etc using some
> recorder?
>
> Regards,
> Anders
>
> > -----Original Message-----
> > From: 6... [mailto:6...] On Behalf Of
> > nishanth_r
> > Sent: Friday, September 24, 2010 6:12 AM
> > To: 6...
> > Subject: [68HC12] Dragon 12 SCI
> >
> > Hey All,
> > I'm working on a project with a Dragon12 board running codewarrior
> for
> > the code. i'm trying to get position control of an arm connected to a
> motor. I
> > manged to get this done, but it kinda oscillates and so my professor
> suggested
> > i analyse the position values to get a proper proportional control value.
> i'm
> > trying to use SCI to get output my position error values so i can plot
> them.
> > could someone please suggest a good method to continuously output the
> values
> > say to a text file on my comp or as an array list in hyperterminal?
> >
> > Thanks,
> > Nish
> >
> >
> >
> >
> >
> >
Seems reasonable, but thats too complicated for me :) i was hoping for something simpler, like getting the data out and using matlab to plot the step response and get a proportional control value using zn step response :) i'm familiar with that :)
Nish
--- In 6..., "Anders Friberg" wrote:
>
> How about using the two DAC:s to plot the position, error etc using some
> recorder?
>
> Regards,
> Anders
>
> > -----Original Message-----
> > From: 6... [mailto:6...] On Behalf Of
> > nishanth_r
> > Sent: Friday, September 24, 2010 6:12 AM
> > To: 6...
> > Subject: [68HC12] Dragon 12 SCI
> >
> > Hey All,
> > I'm working on a project with a Dragon12 board running codewarrior
> for
> > the code. i'm trying to get position control of an arm connected to a
> motor. I
> > manged to get this done, but it kinda oscillates and so my professor
> suggested
> > i analyse the position values to get a proper proportional control value.
> i'm
> > trying to use SCI to get output my position error values so i can plot
> them.
> > could someone please suggest a good method to continuously output the
> values
> > say to a text file on my comp or as an array list in hyperterminal?
> >
> > Thanks,
> > Nish
> >
> >
> >
> >
> >
> >
Reply by ●September 24, 20102010-09-24
Do you have a working SCI? Can you send characters out using something like putc
or printf or are you loading the transmit register?
You say you have the SCI to transmit and receive at 115kbaud, use printf("%d,%d,%d,%d\r\n",adcval1, adcval2, adcval3); . Capture the data in hyperterm, make the problem happen, stop the capture, process the data file in your favourite spreadsheet.
I'm apparently missing something.
A
On 2010-September-24, at 8:10 AM, nishanth_r wrote:
> Hey Andrei,
> Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
>
> Thanks again,
> Nish
>
> --- In 6..., Andrei Chichak wrote:
> >
> > In hyperterm
> >
> > Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
> >
> > A
> >
> >
> > On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> >
> > > Hey All,
> > > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> > >
> > > Thanks,
> > > Nish
> > >
> > >
You say you have the SCI to transmit and receive at 115kbaud, use printf("%d,%d,%d,%d\r\n",adcval1, adcval2, adcval3); . Capture the data in hyperterm, make the problem happen, stop the capture, process the data file in your favourite spreadsheet.
I'm apparently missing something.
A
On 2010-September-24, at 8:10 AM, nishanth_r wrote:
> Hey Andrei,
> Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
>
> Thanks again,
> Nish
>
> --- In 6..., Andrei Chichak wrote:
> >
> > In hyperterm
> >
> > Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
> >
> > A
> >
> >
> > On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> >
> > > Hey All,
> > > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> > >
> > > Thanks,
> > > Nish
> > >
> > >
Reply by ●September 25, 20102010-09-25
Hi Andrei,
This is my code so far...
/* set system clock frequency to _BUSCLOCK MHz (24 or 4) */
PLL_Init();
/* activate ADC, enable for ADC interrupt */
ADC_Init();
/* initialize PWM unit */
PWM_Init();
SCI1_Init();
//bias = ADC_Read(7);
/* forever */
while (flag == 0){
v_set = ADC_Read(6); // channel AN06, desired position
//v_set = 500;
if (v_set < 100){
v_set = 100;
} //end if
if (v_set > 916){
v_set = 916;
} // Set range of input values
bias = ADC_Read(7); // channel AN07, feedback signal
if(bias < 496){
bias = 496;
}
v = 15*(bias - 496); //Reduce to range 0 : 0.5
PosError = 10*(v_set - v);
//Determine Polarity of signal
if (PosError < 0){
PTH |= 0x08; // Toggle Channel 3 on port H
PosError = -1*PosError;
} else {
PTH &= ~0x08;
}
//beyond a range of values, set max PWM signal
if (PosError > 900){
PosError = 1000;
}
SCI1_OutChar(PosError); //This outputs the position values
// Check for end of loop
if (PosError == 0){
flag = 1;
}
PWM_SetDuty(PosError);
}
} //end main
and my SCI is:
void SCI1_Init() {
SCI1BDH = 0; // br=MCLK/(16*baudRate)
SCI1BDH=0;
SCI1BDL;
SCI1CR1 = 0;
SCI1CR2 = 0x0C;
void SCI1_OutChar(char data) {
while((SCI1SR1 & TDRE) == 0){};
SCI1DRL = data;
}
}
Now, I haven't tested the SCI part. Any problems you forsee? my clock is running at 24Khz. Where would I have to implement the printf function? I see you have given multiple values, but mine is sending the same value over and over. Thanks.
Nish
--- In 6..., Andrei Chichak wrote:
>
> Do you have a working SCI? Can you send characters out using something like putc or printf or are you loading the transmit register?
>
> You say you have the SCI to transmit and receive at 115kbaud, use printf("%d,%d,%d,%d\r\n",adcval1, adcval2, adcval3); . Capture the data in hyperterm, make the problem happen, stop the capture, process the data file in your favourite spreadsheet.
>
> I'm apparently missing something.
>
> A
> On 2010-September-24, at 8:10 AM, nishanth_r wrote:
>
> > Hey Andrei,
> > Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
> >
> > Thanks again,
> > Nish
> >
> > --- In 6..., Andrei Chichak wrote:
> > >
> > > In hyperterm
> > >
> > > Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
> > >
> > > A
> > >
> > >
> > > On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> > >
> > > > Hey All,
> > > > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> > > >
> > > > Thanks,
> > > > Nish
> > > >
> > > >
>
>
This is my code so far...
/* set system clock frequency to _BUSCLOCK MHz (24 or 4) */
PLL_Init();
/* activate ADC, enable for ADC interrupt */
ADC_Init();
/* initialize PWM unit */
PWM_Init();
SCI1_Init();
//bias = ADC_Read(7);
/* forever */
while (flag == 0){
v_set = ADC_Read(6); // channel AN06, desired position
//v_set = 500;
if (v_set < 100){
v_set = 100;
} //end if
if (v_set > 916){
v_set = 916;
} // Set range of input values
bias = ADC_Read(7); // channel AN07, feedback signal
if(bias < 496){
bias = 496;
}
v = 15*(bias - 496); //Reduce to range 0 : 0.5
PosError = 10*(v_set - v);
//Determine Polarity of signal
if (PosError < 0){
PTH |= 0x08; // Toggle Channel 3 on port H
PosError = -1*PosError;
} else {
PTH &= ~0x08;
}
//beyond a range of values, set max PWM signal
if (PosError > 900){
PosError = 1000;
}
SCI1_OutChar(PosError); //This outputs the position values
// Check for end of loop
if (PosError == 0){
flag = 1;
}
PWM_SetDuty(PosError);
}
} //end main
and my SCI is:
void SCI1_Init() {
SCI1BDH = 0; // br=MCLK/(16*baudRate)
SCI1BDH=0;
SCI1BDL;
SCI1CR1 = 0;
SCI1CR2 = 0x0C;
void SCI1_OutChar(char data) {
while((SCI1SR1 & TDRE) == 0){};
SCI1DRL = data;
}
}
Now, I haven't tested the SCI part. Any problems you forsee? my clock is running at 24Khz. Where would I have to implement the printf function? I see you have given multiple values, but mine is sending the same value over and over. Thanks.
Nish
--- In 6..., Andrei Chichak wrote:
>
> Do you have a working SCI? Can you send characters out using something like putc or printf or are you loading the transmit register?
>
> You say you have the SCI to transmit and receive at 115kbaud, use printf("%d,%d,%d,%d\r\n",adcval1, adcval2, adcval3); . Capture the data in hyperterm, make the problem happen, stop the capture, process the data file in your favourite spreadsheet.
>
> I'm apparently missing something.
>
> A
> On 2010-September-24, at 8:10 AM, nishanth_r wrote:
>
> > Hey Andrei,
> > Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
> >
> > Thanks again,
> > Nish
> >
> > --- In 6..., Andrei Chichak wrote:
> > >
> > > In hyperterm
> > >
> > > Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
> > >
> > > A
> > >
> > >
> > > On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> > >
> > > > Hey All,
> > > > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> > > >
> > > > Thanks,
> > > > Nish
> > > >
> > > >
>
>
Reply by ●September 26, 20102010-09-26
Hi Again,
Sorry for spamming like this, just wanted to report that I managed to get that code working, the outchar (though i realised its outdec actually) i'll write it to a text file and then pick the values off it. Thanks again for all your help!!!
there is one other problem i've been trying to solve, would be grateful for any input:
the potentiometer i'm using for motor feedback is actually an incremental encoder. I need just 1 turn off it out of 10 and so i need to make it independent of its current position. so i used this: bias = ADC_Read(7); before the beginning of loop to get an initial reading. but when i did run the program, the ADC wouldn't read the value again after the loop began. I'm not using interrupts, just polling (meaning it wouldn't read ADC(6)) any thoughts on this?
Thanks again,
Nish
--- In 6..., "nishanth_r" wrote:
>
> Hi Andrei,
> This is my code so far...
> /* set system clock frequency to _BUSCLOCK MHz (24 or 4) */
> PLL_Init();
>
> /* activate ADC, enable for ADC interrupt */
> ADC_Init();
>
> /* initialize PWM unit */
> PWM_Init();
>
> SCI1_Init();
>
> bias = ADC_Read(7);
>
> /* forever */
> while (flag == 0){
> v_set = ADC_Read(6); // channel AN06, desired position
> //v_set = 500;
> if (v_set < 100){
> v_set = 100;
> } //end if
> if (v_set > 916){
> v_set = 916;
> } // Set range of input values
>
> bias = ADC_Read(7); // channel AN07, feedback signal
> if(bias < 496){
> bias = 496;
> }
> v = 15*(bias - 496); //Reduce to range 0 : 0.5
>
> PosError = 10*(v_set - v);
>
> //Determine Polarity of signal
> if (PosError < 0){
> PTH |= 0x08; // Toggle Channel 3 on port H
> PosError = -1*PosError;
> } else {
> PTH &= ~0x08;
> }
>
> //beyond a range of values, set max PWM signal
> if (PosError > 900){
> PosError = 1000;
> }
> SCI1_OutChar(PosError); //This outputs the position values
> // Check for end of loop
> if (PosError == 0){
> flag = 1;
> }
> PWM_SetDuty(PosError);
> }
> } //end main
>
> and my SCI is:
> void SCI1_Init() {
>
> SCI1BDH = 0; // br=MCLK/(16*baudRate)
> SCI1BDH=0;
> SCI1BDL;
> SCI1CR1 = 0;
> SCI1CR2 = 0x0C;
>
> void SCI1_OutChar(char data) {
>
> while((SCI1SR1 & TDRE) == 0){};
> SCI1DRL = data;
>
> }
> }
>
> Now, I haven't tested the SCI part. Any problems you forsee? my clock is running at 24Khz. Where would I have to implement the printf function? I see you have given multiple values, but mine is sending the same value over and over. Thanks.
>
> Nish
>
> --- In 6..., Andrei Chichak wrote:
> >
> > Do you have a working SCI? Can you send characters out using something like putc or printf or are you loading the transmit register?
> >
> > You say you have the SCI to transmit and receive at 115kbaud, use printf("%d,%d,%d,%d\r\n",adcval1, adcval2, adcval3); . Capture the data in hyperterm, make the problem happen, stop the capture, process the data file in your favourite spreadsheet.
> >
> > I'm apparently missing something.
> >
> > A
> >
> >
> > On 2010-September-24, at 8:10 AM, nishanth_r wrote:
> >
> > > Hey Andrei,
> > > Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
> > >
> > > Thanks again,
> > > Nish
> > >
> > > --- In 6..., Andrei Chichak wrote:
> > > >
> > > > In hyperterm
> > > >
> > > > Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
> > > >
> > > > A
> > > >
> > > >
> > > > On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> > > >
> > > > > Hey All,
> > > > > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> > > > >
> > > > > Thanks,
> > > > > Nish
> > > > >
> > > > >
> >
> >
> >
>
Sorry for spamming like this, just wanted to report that I managed to get that code working, the outchar (though i realised its outdec actually) i'll write it to a text file and then pick the values off it. Thanks again for all your help!!!
there is one other problem i've been trying to solve, would be grateful for any input:
the potentiometer i'm using for motor feedback is actually an incremental encoder. I need just 1 turn off it out of 10 and so i need to make it independent of its current position. so i used this: bias = ADC_Read(7); before the beginning of loop to get an initial reading. but when i did run the program, the ADC wouldn't read the value again after the loop began. I'm not using interrupts, just polling (meaning it wouldn't read ADC(6)) any thoughts on this?
Thanks again,
Nish
--- In 6..., "nishanth_r" wrote:
>
> Hi Andrei,
> This is my code so far...
> /* set system clock frequency to _BUSCLOCK MHz (24 or 4) */
> PLL_Init();
>
> /* activate ADC, enable for ADC interrupt */
> ADC_Init();
>
> /* initialize PWM unit */
> PWM_Init();
>
> SCI1_Init();
>
> bias = ADC_Read(7);
>
> /* forever */
> while (flag == 0){
> v_set = ADC_Read(6); // channel AN06, desired position
> //v_set = 500;
> if (v_set < 100){
> v_set = 100;
> } //end if
> if (v_set > 916){
> v_set = 916;
> } // Set range of input values
>
> bias = ADC_Read(7); // channel AN07, feedback signal
> if(bias < 496){
> bias = 496;
> }
> v = 15*(bias - 496); //Reduce to range 0 : 0.5
>
> PosError = 10*(v_set - v);
>
> //Determine Polarity of signal
> if (PosError < 0){
> PTH |= 0x08; // Toggle Channel 3 on port H
> PosError = -1*PosError;
> } else {
> PTH &= ~0x08;
> }
>
> //beyond a range of values, set max PWM signal
> if (PosError > 900){
> PosError = 1000;
> }
> SCI1_OutChar(PosError); //This outputs the position values
> // Check for end of loop
> if (PosError == 0){
> flag = 1;
> }
> PWM_SetDuty(PosError);
> }
> } //end main
>
> and my SCI is:
> void SCI1_Init() {
>
> SCI1BDH = 0; // br=MCLK/(16*baudRate)
> SCI1BDH=0;
> SCI1BDL;
> SCI1CR1 = 0;
> SCI1CR2 = 0x0C;
>
> void SCI1_OutChar(char data) {
>
> while((SCI1SR1 & TDRE) == 0){};
> SCI1DRL = data;
>
> }
> }
>
> Now, I haven't tested the SCI part. Any problems you forsee? my clock is running at 24Khz. Where would I have to implement the printf function? I see you have given multiple values, but mine is sending the same value over and over. Thanks.
>
> Nish
>
> --- In 6..., Andrei Chichak wrote:
> >
> > Do you have a working SCI? Can you send characters out using something like putc or printf or are you loading the transmit register?
> >
> > You say you have the SCI to transmit and receive at 115kbaud, use printf("%d,%d,%d,%d\r\n",adcval1, adcval2, adcval3); . Capture the data in hyperterm, make the problem happen, stop the capture, process the data file in your favourite spreadsheet.
> >
> > I'm apparently missing something.
> >
> > A
> >
> >
> > On 2010-September-24, at 8:10 AM, nishanth_r wrote:
> >
> > > Hey Andrei,
> > > Thanks a lot for the reply. I'm new to the whole concept of micro-controller programming, so could you please elaborate on how to do that.... right now, i'm yet to test sending the data to hyperterminal in a continuous stream (no idea if it will work, got the sci to transmit and receive at 115k so far) any snippets of code will be really appreciated :)
> > >
> > > Thanks again,
> > > Nish
> > >
> > > --- In 6..., Andrei Chichak wrote:
> > > >
> > > > In hyperterm
> > > >
> > > > Shoot out the data in displayable ASCII with commas between the various values and a CR and LF at the end of the line (.csv format). Throw it into OpenOffice spreadsheet and away you go.
> > > >
> > > > A
> > > >
> > > >
> > > > On 2010-September-23, at 10:12 PM, nishanth_r wrote:
> > > >
> > > > > Hey All,
> > > > > I'm working on a project with a Dragon12 board running codewarrior for the code. i'm trying to get position control of an arm connected to a motor. I manged to get this done, but it kinda oscillates and so my professor suggested i analyse the position values to get a proper proportional control value. i'm trying to use SCI to get output my position error values so i can plot them. could someone please suggest a good method to continuously output the values say to a text file on my comp or as an array list in hyperterminal?
> > > > >
> > > > > Thanks,
> > > > > Nish
> > > > >
> > > > >
> >
> >
> >
>