Oscillators/PCA/Timers/SMBus/UART/SPI
  f340 SDCC PCA0MD watchdog

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   f340 SDCC PCA0MD watchdog
roodpart
New Member
posted August 06, 2010 07:12 PM     Click Here to See the Profile for roodpart   Click Here to Email roodpart     Edit/Delete Message
Hi,

I was wondering if someone could help me with this problem I'm having with the f340.

I compile and run the blinky code with KEIL and it runs fine.

I am aware that I need to use the following to disable the watchdog timer:

unsigned char _sdcc_external_startup ( void )
{
//PCA0MD= 0x00;
PCA0MD &= ~0x40; // Disable Watchdog timer temporarily
return 0;
}

But every time I check, PCA0MD remains 0x40 and RSTSRC=0x08, which means that the watchdog is still resetting the micro.

Thanks.

IP: Logged

Tsuneo
Member
posted August 06, 2010 08:30 PM     Click Here to See the Profile for Tsuneo   Click Here to Email Tsuneo     Edit/Delete Message
Is _sdcc_external_startup() placed with main() on the same file?

Tsuneo

[This message has been edited by Tsuneo (edited August 06, 2010).]

IP: Logged

roodpart
New Member
posted August 06, 2010 10:19 PM     Click Here to See the Profile for roodpart   Click Here to Email roodpart     Edit/Delete Message
yes. this is all I have:

#include "C8051F340.h"

// Peripheral specific initialization functions,
// Called from the Init_Device() function
void PCA_Init()
{
PCA0MD &= ~0x40;
PCA0MD = 0x00;
}

// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
PCA_Init();
}

char _sdcc_external_startup()
{
PCA0MD &= ~0x40; // Disable Watchdog timer temporarily
Init_Device();
return 0;
}

void main(void)
{
while(1)
{
}
}
----

IP: Logged

roodpart
New Member
posted August 07, 2010 01:16 AM     Click Here to See the Profile for roodpart   Click Here to Email roodpart     Edit/Delete Message
Hmm. the problem seems to have gone away after moving the header file to the same directory.

sorry and thanks for the help.

IP: Logged

vanmierlo
Member
posted August 09, 2010 01:21 PM     Click Here to See the Profile for vanmierlo   Click Here to Email vanmierlo     Edit/Delete Message
#include "C8051F340.h"

With quotes your including the header file from the current directory which might be for Keil only. With < > you should get the one from the SDCC distribution.

But there's more. The latest IDE adds an extra search path to its own include directory and then even with < > SDCC might still use the Keil version.

The problem with the Keil format for sfr definitions is that it reuses C syntax for assignment for setting the address of the sfr. SDCC happily accepts this assignment to the newly defined sfr variable which has no particular address and gets a random address from the linker.

Maarten

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | MCU User Forum

Have you seen our MCU Knowledge Base?


Ultimate Bulletin Board 5.47b