Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - alex077

1
Web platform / Re: Help with ADC, PWM, Timer, etc
Thank you very much for your help!
Here is my test code:
Code: [Select]
               putsUART3("nr");putsUART3("nr");
rtcc_get_tm(&tt);
uitoa(tt.tm_hour,str);  putsUART3(str);  putsUART3(":");
uitoa(tt.tm_min,str);  putsUART3(str);  putsUART3(":");
uitoa(tt.tm_sec,str);    putsUART3(str);  putsUART3("nr");
ultoa(tt.tm_year+2000,yearstr); putsUART3(yearstr); putsUART3(".");
uitoa(tt.tm_mon+1,str);  putsUART3(str);  putsUART3(".");
uitoa(tt.tm_mday,str); putsUART3(str);  putsUART3(".");putsUART3("nr");
putsUART3("BCD:t");
rtcc_get_bcd_tm(&t);
uitoa(bcdL2char(t.hour),str); putsUART3(str); putsUART3(":");
uitoa(bcdL2char(t.min),str);  putsUART3(str); putsUART3(":");
uitoa(bcdL2char(t.sec),str);  putsUART3(str); putsUART3("nrt20");

uitoa(bcdL2char(t.year),str); putsUART3(str); putsUART3(".");
uitoa(bcdL2char(t.mon),str); putsUART3(str); putsUART3(".");
uitoa(bcdL2char(t.day),str);  putsUART3(str); putsUART3(".");
Result:
Code: [Select]
23:59:58
2011.12.31.
BCD:    23:59:58
        2011.12.31.

23:59:59
2011.12.31.
BCD:    23:59:59
        2011.12.31.

0:0:0
2012.1.1.
BCD:    0:0:0
        2012.1.1.

0:0:1
2012.1.1.
BCD:    0:0:1
        2012.1.1.

0:0:2
2012.1.1.
BCD:    0:0:2
        2012.1.1.
2
Web platform / Re: Help with ADC, PWM, Timer, etc
I have a new trouble :(
I want to use the internal RTCC. I copied the codes for RTCC from FREERTOS project. (rtcc.c and rtcc.h)
It seems correct working, but I don't know how to use exactly.
My InitHardware function (still in SD card webserver project):
rtcc_init(); at the end

in main:
Code: [Select]
...#include "RTCC.h"...
...  char str[25];  //temporary storage for uitoa
...
AppConfig.SecondaryDNSServer.Val = MY_DEFAULT_SECONDARY_DNS_BYTE1 | MY_DEFAULT_SECONDARY_DNS_BYTE2<<8ul  | MY_DEFAULT_SECONDARY_DNS_BYTE3<<16ul  | MY_DEFAULT_SECONDARY_DNS_BYTE4<<24ul;

struct tm ts;
struct rtcc_bcd_tm t;
struct tm tt;
ts.tm_hour=24;
ts.tm_mday=26;
ts.tm_min=59;
ts.tm_mon=8;
ts.tm_sec=30;
ts.tm_wday=5;
ts.tm_year=2011;

rtcc_set_tm(ts);

    StackInit(); //setup the stack

while(1){//never ending loop

if(FSready==FALSE) FSready=FileSystemInit(); //attempt to initialize the FAT SD card library

        if((TickGet() - ticks) >= (TICK_SECOND/2)){ //blink LED
            ticks = TickGet();
            LED0_IO ^= 1;

if(BUTTON2_IO==0)
{
LED3_IO^=1;
putsUART3("nr");putsUART3("nr");
rtcc_get_tm(&tt);uitoa(tt.tm_hour,str);
putsUART3(str);putsUART3(":");
uitoa(tt.tm_min,str);//putsUART3(":");
putsUART3(str);putsUART3(":");
uitoa(tt.tm_sec,str);putsUART3(str);putsUART3("nr");
uitoa(tt.tm_year,str);putsUART3(str);putsUART3(".");
uitoa(tt.tm_mon,str);putsUART3(str);putsUART3(".");
uitoa(tt.tm_mday,str);putsUART3(str);putsUART3(".");


}
        }
...
I have attached the source files of RTCC.

In my serial terminal now I see:
Code: [Select]
                                                                                                                                                                   
24:59:58                                                                                                                                                           
219.7.26.                                                                                                                                                         
                                                                                                                                                                   
24:59:59                                                                                                                                                           
219.7.26.                                                                                                                                                         
                                                                                                                                                                   
24:59:59                                                                                                                                                           
219.7.26.                                                                                                                                                         
                                                                                                                                                                   
25:0:0                                                                                                                                                             
219.7.26.                                                                                                                                                         
                                                                                                                                                                   
25:0:0                                                                                                                                                             
219.7.26.                                                                                                                                                         
                                                                                                                                                                   
25:0:1                                                                                                                                                             
219.7.26.   

219 should be 2011
ts.tm_year=11;  wasn't good  (maybe it was 217..)
So it is a problem with the formatting. Any idea what I am doing wrong?
That wasn't good:
Code: [Select]
//putsUART3(tt.tm_hour);putsUART3(":");putsUART3(tt.tm_min);
//putsUART3(":");putsUART3(tt.tm_sec);
I think by setting is the format wrong.


Update:
My settings were wrong. My new (test) settings:
Code: [Select]
ts.tm_hour=23;
ts.tm_mday=31;
ts.tm_min=59;
ts.tm_mon=12;
ts.tm_sec=55;
ts.tm_wday=3;
ts.tm_year=11;
REsult:
Code: [Select]
...
                                                                                                                                                                   
23:59:59                                                                                                                                                           
267.11.31.                                                                                                                                                         
                                                                                                                                                                   
0:0:0                                                                                                                                                             
268.0.1.
...

Update2:
I made the following changes:
add: long yearstr[10];
ultoa(tt.tm_year,yearstr);putsUART3(yearstr);   
Not uitoa! 
But the result is still the same. How can I fix this year displaying problem?
With ts.tm_year=2011; the result is 220.0.1.
4
Web platform / Re: Help with ADC, PWM, Timer, etc
No effect :(

With:    AD1CON2 = 0x0404;         // AVdd, AVss, int every 2 conversions, MUXA only, scan
it measures something, just don't know what
6
Web platform / Re: Help with ADC, PWM, Timer, etc
It works in SD Card webserver. C30: c3.30b, TCPIP Stack: 5.36
Add to static void InitHardware(void) :
Code: [Select]
// ADC
AD1CHS0 = 0;                            // Input to AN0 (potentiometer)
AD1CON1 = 0x84E4; // Turn on, auto sample start, auto-convert, 12 bit mode (on parts with a 12bit A/D)
AD1CON2 = 0x0404; // AVdd, AVss, int every 2 conversions, MUXA only, scan
AD1CON3 = 0x1003; // 16 Tad auto-sample, Tad = 3*Tcy
Now I see on the homepage only numbers between 20 and 40, and it isn't stabil...
I cannot change the value with the potentiometer.
Any suggestion?
8
Web platform / Re: Help with ADC, PWM, Timer, etc
I read this intro tutorial, but that isn't a big help to me. I don't know how to use ADC by this PIC.
I found examples only for dsPIC30-s, is it same for dsPIC33-s?
I need few examples to learn use this compiler. (for this PIC! on webplatform)
9
Web platform / Re: Cannot compile source code for Webserver
I solved the problem!!! (so I'm very happy now :) )
In HTTP_IO_RESULT HTTPExecutePost(void)
Code: [Select]
if(cwdPathPtr[i] == (BYTE)'p')   // change 'e' to 'p'
if(!memcmppgm2ram(&cwdPathPtr[i], "protect",5))//is CWD == protect ?  change email to protect
if(!memcmppgm2ram(filename, "email.htm",9))  //if i remember right here was index.htm

In cwdPathPtr is stored the Current Work Directory
original was email, now protect
10
Web platform / Re: Cannot compile source code for Webserver
I didn't found any mailserver log file. Where do I have to search it?
I suppose the problem is maybe here:
in function: HTTP_IO_RESULT HTTPExecutePost(void)
Code: [Select]
#ifdef STACK_USE_MDD

#if defined(STACK_USE_SMTP_CLIENT) || defined(STACK_USE_DYNAMICDNS_CLIENT)
cwdPathPtr=FSgetcwd ((char *) cwdPath, 20); //We are taking 20 bytes of buffer to store the CWD

for(i=0;i<20;i++) //Convert CWD path string to lower case
if((cwdPathPtr[i] >= (BYTE)'A') && (cwdPathPtr[i] <= (BYTE)'Z'))
cwdPathPtr[i] += 'a' - 'A';

for(i=0;i<20;i++)
{
if(cwdPathPtr[i] == (BYTE)'e') //email
{
if(!memcmppgm2ram(&cwdPathPtr[i], "email",5))//is CWD == email ?
//if(!memcmppgm2ram(&cwdPathPtr[i], "protect",5))//is CWD == email ?
{
//In MDD, to open a file, we change current working directory to
//the file directory. Hence only the reuqested file name need to be compared.
if(!memcmppgm2ram(filename, "index.htm",9))
// if(!memcmppgm2ram(filename, "email.htm",9))
return HTTPPostEmail();
}
}
else if(cwdPathPtr[i] == (BYTE)'d') //dyndns
{
if(!memcmppgm2ram(&cwdPathPtr[i], "dyndns",6))//is CWD == dyndns ?
{
// if(!memcmppgm2ram(filename, "index.htm",9))
//return HTTPPostDDNSConfig();
}
}


}
if(i==21) //This means current working directory is not "email"
return HTTP_IO_DONE; //return as we cant process this request.

#else

#if defined(STACK_USE_SMTP_CLIENT)
//if(!strcmppgm2ram((char*)filename, "email/index.htm"))
if(!strcmppgm2ram((char*)filename, "protect/email.htm"))
return HTTPPostEmail();
#endif

#if defined(STACK_USE_DYNAMICDNS_CLIENT)
// if(!strcmppgm2ram((char*)filename, "dyndns/index.htm"))
//return HTTPPostDDNSConfig();
#endif

in function: static HTTP_IO_RESULT HTTPPostEmail(void)
Code: [Select]
// Redirect to the page
//strcpypgm2ram((char*)curHTTP.data, "/email/index.htm");
strcpypgm2ram((char*)curHTTP.data, "//protect/email.htm");
curHTTP.httpStatus = HTTP_REDIRECT;
return HTTP_IO_DONE;
"//" is somewhere defined as MDD rootdir
It doesn't work without /, with /, and with //
It would be a big help, if I could send data via serial port. I tried UART1TX("H"); and UART1TX('h'); but doesn't work :(

Update: I call InitializeUART1(); , after that : UART1TX('h');UART1TX('e');UART1TX('l');UART1TX('l');UART1TX('o');
in never ending loop: UART1TX('A');
In Tera Term (with baudrate 115200) I see only "˙˙˙˙˙˙"...
11
Web platform / Re: Cannot compile source code for Webserver
I didn't know the right option is MDD. I selected it, generated, recompiled, etc and works!
But not perfect. When I clicked on send button the page is reloaded, but the message isn't sendet and there is no message about "Your message have been sent" or not.
The same steps did you followed as you writed here (by getting work email sending by sd card webserver)?http://http://dangerousprototypes.com/forum/viewtopic.php?f=24&t=475
By eeprom version worked in protect folder too.
13
Web platform / Re: Cannot compile source code for Webserver
I have a new problem:
By the eeprom webserver demo all modifications worked properly. (detailed here: http://http://dangerousprototypes.com/forum/viewtopic.php?f=24&t=475)
Now I wanted to add email sending to restricted zone (protect folder).
1, I created a new folder (protect).
2, I copied email.htm from the eeprom webserver project to protect folder.
3, I changed header.inc: <a href="/protect/email.htm">Send E-mail[/url]
4, I changed in CustomHTTPApp.c:
in function
Code: [Select]
static HTTP_IO_RESULT HTTPPostEmail(void)
:
Code: [Select]
strcpypgm2ram((char*)curHTTP.data, "/email/index.htm");
  to
Code: [Select]
 strcpypgm2ram((char*)curHTTP.data, "protect/email.htm");

---
in function
Code: [Select]
HTTP_IO_RESULT HTTPExecutePost(void)
:
Code: [Select]
if(!strcmppgm2ram((char*)filename, "email/index.htm"))
to
Code: [Select]
if(!strcmppgm2ram((char*)filename, "protect/email.htm"))

commented out
Code: [Select]
if(!memcmppgm2ram(filename, "index.htm",9))
return HTTPPostDDNSConfig();
if(!strcmppgm2ram((char*)filename, "dyndns/index.htm"))
return HTTPPostDDNSConfig();
beacuse HTTPPostDDNSConfig(); does not exist.
5, In TCPIPConfig.h enabled the email and other demos, as described here: http://http://dangerousprototypes.com/forum/viewtopic.php?f=24&t=475
6, deleted HTTPPrint.h , HTTPPrint.idx
7, runned MPFS2.exe (without upload)
8, copied files from Webpages2 to SD card and DynRcrd.bin, FileRcrd.bin
9, recompiled the project and downloaded to PIC
When I open the demo page in my browser I can only after authentication open email.htm (as expected), but only the text is displayed. Nothing else. It seems the browser don't find header.inc, footer.inc, etc.
Is it expected that DynRcrd.bin and FileRcrd.bin aren't overwrited? Last modification: ‎2011. 06. ‎03., ‏‎1:40:15  (yyyy, mm, dd format), today is: 21/08
Any idea what to do?
Thank you!
14
Web platform / Re: Cannot compile source code for Webserver
SD card webserver demo working!!
But there is a bug: When I open the demo page in chrome: after toggle one LED than blinking stops (only on page, on hardware the LED is still blinking, and the other LED toggles, when I click to toggle, but on the page I don't see any changing)
In firefox works fine!
The eeprom version worked fine in both browser.
Here is my webserver: http://alex077.dyndns-at-work.com/
15
Web platform / Re: Cannot compile source code for Webserver
I found the problem: In the project file:
...
file_002=..MicrochipTCPIP StackTick.c
...
"..Microchip..." was the problem.
I replaced all ".." to "C:Microchip Solutions" and it works...
So build succeeded.

Before that I renamed my "MS SD" directory to "Microchip Solutions"

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01692489008session_write_close ( )...(null):0
20.01722620584ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01722621360Database_MySQL->query( ).../DatabaseHandler.php:119
40.06122760080Database_MySQL->error( ).../Db-mysql.class.php:273