yeah so I checked this
int setValue = 0;
int feedbackValue = 0;
static int errorValue = 0;
static int prevError = 0;
static int integral = 0;
int derivative = 0;
Type: Posts; User: dcwang3
yeah so I checked this
int setValue = 0;
int feedbackValue = 0;
static int errorValue = 0;
static int prevError = 0;
static int integral = 0;
int derivative = 0;
the max range that I need is from -20,000 to 20,000. So obviously I don't need signed long. Do you think switching to a smaller type like int16_t would be better and have less problems? I modified a...
As far as compiler version, I think I have AVRGCC 3.4.1.95 that has GCC 4.6.2 for 8-bit AVR microcontrollers.
I am using Atmel Studio 6 for the IDE.
I tried the 255L and -255L but that didn't work.
I also just printed out the signed long output = -255, and it prints out -255. So that looks fine
I'll try that on the hardware to see what happens
Yeah I have checked that that statement is being hit.
I have also checked that errorValue becomes negative. Everything up to the output IF statement is correct, I made sure of that by printing...
thanks for the replies
KP,KI, and KD are macro define statements, as shown below for right now.
#define KP 5
#define KI 0
#define KD 0
I don't know what compiler I am using, I guess GCC...
Here is the actual function.
I have isolated the problem between
output = (KP*errorValue) + .....
and the IF statement that limits output between -255 and 255... It works when output is...
So I am writing C code for firmware on an 8-bit microcontroller.
I am trying to determine why my code does not work for negative numbers.
Below is a code snippet that is sort of an example:
...
So I read that tutorial and other articles about HTTP protocols....In my case, in the main program (easyweb.c), it essentially setups the ethernet controller, etc... Then it hits the main while loop...
well, I suppose that if a GET request from the web browser occurs, how is it received by the ethernet controller? Does it automatically get transfer to the RXdatabuffer of the ethernet controller?
here are the rest of the attachments
cs8900.c/.h --> contain the ethernet driver information
webside.c --> webpage
tcpip.h/.c --> the TCP/IP stack
easyweb.c/.h --> contain the main program and...
I am trying to modify code from the Olimex EasyWeb3 board. It uses an MSP430F149 and a crystal lan cs8900a ethernet controller. There is a sample code for a simple web server. I am interested in...
oh so basically the original code changes only the bits you are interested in either using an OR operator to turn something on, and an AND operator to turn something off.
Also, when they have the...
Ok, here is my code.
There is 1 warning and it says, statement with no effect...It is for the for loop statement near the end in the main section. Do you know what the problem is?
...
Is there another way to write it to have the same function? I'm just sort of having a hard time visualizing it as that.
Can it be like:
_delay_ms(half_period);
BUZZER_PORT = 0x01;...
but what does the (1 << BUZZER_PIN) do? that's what I don't understand
well, I guess I am looking for more of a general answer.
But here is what I am using. ATMEL ATMEGA324P, with AVR Studio 4 as my environment. And basically, I am going to have a piezo buzzer...
I am trying to figure out how to write a c program/algorithm that will output music tone (like middle C, C#, D, etc...). I am using an ATMEGA324P chip, and coding in C.
I am trying not to use the...
I actually found out what the problem wrong...
if(sort_input == 'n') //NAME SORT
{
for(i = 0; i...
when you have an array like this:
entry[i].name
Can you automatically assume that it is a pointer and you can assign it to 0 or \0 like this:
entry[i].name = 0 or entry[i].name = '\0'
I...
ok so here is part of the code I am working on, it's sort of a manipulation of the code from above:
if(sort_input == 'n') //NAME SORT ...
also, is
folders[i].nfield[0] = '\0';
is the same thing as this?
Adak:
for(i = 0; i < k-1; i++) {
for(j = i+1; j < k; j++) {
if(strcmp(folders[i].nfield, folders[j].nfield) > 0) {
name = '\0';
strcpy(name,...