Search Forums by tag:
Serial, mbed, compiler, ethernet, USB, I2C, SPI, interrupt, LCD, library, bug, HTTPServer, CAN, adc, AnalogIn, memory, SD Card, InterruptIn, rpc, Power, SDFileSystem, Ticker, canbus, driver, editor, Error, LocalFileSystem, UART, libraries, TCP, GPS, PwmOut, timer, pwm, file, website, accelerometer, C++, reset, SDCard, RTC, interrupts, clock, DigitalIn, TCPSocket, frequency, led, Java, http, buffer, DMA, SD, flash, HTTPClient, pinball, MODSERIAL, problem, printf, filesystem, SerialPC, RFID, beta, LPC1768, rtos, newbie, compile, digitalOut, Servo, UDP, audio, LPC11U24, RPCFunction, EthernetNetIf, NetServices, m3pi, Download, write, socket, multiple, array, sensor, keil, MATLAB, Forum, debug, hardware, Board, I2S, dead, Sleep, xbee, Nokia6610, AnalogOut, tcp/ip, SPI Slave, code, voltage, wait, network, read, suggestion, dac, JTAG, string, pc, keyboard, copy, GPRS, offline, lwip, Speed, DHCP, Data Logging, windows, time, current, MODDMA, mp3, C, gcc, attach, fatfilesystem, USB Host, publish, assembly, stepper motor, WavePlayer, camera, size, VGA, import, documentation, baud, bluetooth, TextLCD, firmware, M0, pullup, Relay, timing, pololu, MIDI, compiler error codes, magjack, client, robot, Communication, stream, HID, breakout, FIFO, prototype, GPIO, sampling, api, binary, filter, ADXL345, program, DSP, help, sram, class, suggestions, email, PING, arduino, rs232, link, wifi, Nokia, browser, control, Host, Eagle, Modbus, ide, linux, port, updates, Cortex-M0, WiFly, DMX, files, scanf, protocol, PPP, FTP, integer, function, latency, serial port, modem, motors, for, monitor, malloc, Digital I/O, Production, FAT, classes, server, webserver, delay, variables, flashing, time-triggered, PCB, c programming, Analog, labview, watchdog, Encoder, post, math, LPCXpresso, MBED website, GSM, storage, nxp, mobileLCD, license, Terminal, int, counter, baseboard, rj45, EEPROM, E289, mac, Timeout, news, connect, pointers, Optocoupler, Robotics, search, USBMIDI, glitch, find, real-time, format, slave, driverlibrary, MODGPS, processing, networking, ID, umts, float, color, BUTTON, Images, wave, bin, const, OSX, supply, peripheral, sensors, RIT, character, bus, ARM, SRF08, heap, output, basic, piezo, pins, keypad, ID12, Pachube, player, DigitalInOut, object, capture, slow, PSP, OS, display, syntax, mbed.lib, EmbeddedArtists, NMEA, paste, project, GUI, UART0, firefox, motor, SQL, RAM, 3D, bugs, Temperature, not, I/O, Bidirectional, rss, resolved, Pin, Assembler, LED1, LIS302, getc, Safari, Vin, wiki, registers, PS2, fopen, BusOut, projects, RS485, pythonPCONP is defined in the System Control block, which is declared as LPC_SC in LPC17xx.h (included from mbed.h):
LPC_SC->PCONP |= 1<<9; // turn on RTCTo work with the backup registers, use RTC block, LPC_RTC:
LPC_RTC->GPREG0 = 0x11223344; // write to General Purpose Register 0
Hi David,
If you look in the mbed API docs (expand mbed library in the compiler), you'll see an interface called "rtc_time" (or you can see it on the web at rtc_time API docs).
The function you want is set_time(), and here is an example:
#include "mbed.h"
int main() {
set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
while(1) {
time_t seconds = time(NULL);
printf("Time as seconds since January 1, 1970 = %d\n", seconds);
printf("Time as a basic string = %s", ctime(&seconds));
char buffer[32];
strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
printf("Time as a custom formatted string = %s", buffer);
wait(1);
}
} This should help get you started using the RTC. Simon
Hi Simon,
I just copied that example and that's what I got (there is not any other code in the program):
why is it not working properly?
Regards.
Have a look at the 32Khz crystal (above LED 3), Check both pads are connected,
also check pin 4 has not gone above 4 Volts, I guess this will kill RTC Circuit inside !
Hope this helps
Ceri
BTW Code works OK on my MBED !
Please log in to post a reply.

No tags
|

I tried the snippet "set the rtc" and the compiler comes up with an error where it doesn't recognize the PCONP (which is a valid register). Does anyone know if this is defined somewhere other than mbed.h? Also , I would like to use the "backup registers" but don't quite know how to do this in the compiler either.