Ashley's Week 9 Report
This Week: Andrew and I met a couple times to test the "wiznetping.c" program on this site: http://www.ermicro.com/blog/?p=1773. We changed some of the pin definitions and settings so that it would match our circuit. We tried to ping the IP address in the "cmd" terminal on my computer, but it kept saying that it was timing out. We tried changing a few different things but kept getting the same message. Later I noticed that there was output in my secureCRT terminal. The output was similar to the output in the image titled "Displaying the Wiznet W5100 Initialization with Serial Terminal" on that website. Basically everything printed was hardcoded and the important part was seeing that the lines such as "Reading GAR: xxx.xxx.x.x" matched the value that we were setting it to and it was not.
We met up on Sunday with Kevin to quickly try this test program again. I wanted to unplug the max232 /rs232 connection to see if the data was getting lost when I tried to "ping" because it was being sent to the secureCRT terminal, but this was not the case. We tried using some of the libraries written in C++ on the arduino website, but had even less luck with that. We couldn't even get it to compile. We thought that this was because we weren't using the actual arduino that should be connected to our ethernet board and missing some of the libraries that they "included" in their code.
We decided just to communicate with Kevin's server program via RS232 just to make sure that things were still working since it had been awhile. At first we had some issues, but resolved them and were able to send him values less than 255 (one byte). We wanted to try to send him the RMS Voltage to make sure that he could get those values correctly from the chip, so we scaled this value accordingly. When there was no power applied to the chip, the average RMS voltage was 72,000. When power was applied, it read about 2,900,000. Using the concept of y = mx + b, we subtracted 72,000 from the RMS voltage value that we read in, and then divided by 23,333 so that our average output was 120V when power was applied. When power wasn't applied, the output should've read 0. A few times it did read 0 or 1, but other times it was quite large. We found that this issue was because the variables were unsigned. I had to leave for work, so we decided to come back to this progress later.
Next Week: Andrew and I plan on working on the RMS current callibration, as well as making any changes to our scaling of the RMS voltage now that he has added isolators to the board. We will need to make sure things are still functioning correctly now that the circuit has been altered.
-----------------------
Main Program
-----------------------
int main(void){
setBitPortB(2); //ADE7763 SS line on PB2; Set to high.
setBitPortB(1);
InitSPI();
ADE_Cal();
usart_init();
sei();
while(1){
while(!uart_buffer_empty()){
char c = usart_getc();
if(c == '1'){
//unsigned char bla = 6;
//usart_putc(bla);
printRegValues();
}
}
}
}
void printRegValues(void)
{
char str1[25];
char str2[25];
char str3[25];
char str4[25];
char str5[25];
uint32_t apparent;
uint32_t active;
int temperature;
uint32_t vRMS;
uint32_t wave;
active = readActive(0x03);
_delay_us(4);
apparent = readApparent(0x06);
_delay_us(4);
vRMS = readVRMS(0x17);
_delay_us(4);
temperature = readTemp();
_delay_us(4);
wave = readWave(0x01);
_delay_us(4);
//RMS voltage scaling
uint32_t rms = vRMS - 72000;
rms = rms/23333;
usart_prints("\r---------------------------------\n");
usart_prints("\r");
usart_prints("The Active Energy is: ");
sprintf(str1, "%ld\n",active);
usart_prints(str1);
usart_prints("\r");
usart_prints("The Apparent Energy is: ");
sprintf(str2, "%ld\n",apparent);
usart_prints(str2);
usart_prints("\r");
usart_prints("The RMS Voltage is: ");
sprintf(str3, "%ld\n",rms);
usart_prints(str3);
usart_prints("\r");
usart_prints("The Temperature is: ");
sprintf(str4, "%d\n",temperature);
usart_prints(str4);
usart_prints("\r");
usart_prints("The Wave is: ");
sprintf(str5, "%ld\n",wave);
usart_prints(str5);
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home