Jump to content
43oh

Electricity monitor - need some help


Recommended Posts

PHP is pretty easy to learn, it was my first language that i had taught my self completely, but PHP is good for dynamic websites but not so much for graphics, you may have to use java or some other language leaning more toward graphics and displays, to use instead and have php as your back-end/ DB access layer to get the data.

Link to post
Share on other sites
  • Replies 78
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

@GeekDoc It does work on my board, I am using CCS. Must be debugger.

In IAR Embedded Workbench this code working too without any problems...

Copy Your code into an old, fully functioning project. You may have accidentally overwritten something in the default settings ...

Posted Images

PHP is good for dynamic websites but not so much for graphics, you may have to use java or some other language leaning more toward graphics and displays

Google is our friend: First hit from "PHP graph library": http://www.ebrueggeman.com/phpgraphlib/

 

Most programming problems have already been solved; you just have to find the right giant shoulders to stand on.

 

-Doc

Link to post
Share on other sites
Google is our friend: First hit from "PHP graph library": http://www.ebrueggeman.com/phpgraphlib/

 

Most programming problems have already been solved; you just have to find the right giant shoulders to stand on.

Yes Google is our friend but i was thinking more real time data then static graphs. and that will work great for displaying the data

and that is a very nice graph library. I will definitely keep a book mark if i ever need it.

Link to post
Share on other sites
  • 3 months later...

I'm back at it with this project, trying to adapt some LCD code I found (http://forum.sparkfun.com/viewtopic.php?t=13656). It compiles fine, but in the debug window I get:

0  0xf8ce

Disassembly:
0x027E:   BFFF 0000           BIT.B   @R15+,0x0000(R15)
...
0xF8CE:   4031 027E           MOV.W   #0x027e,SP

 

The program doesn't load to the chip (running just runs previous program). I have verified that other programs will load to the chip (an MSP430G2231).

 

Can anyone see what I'm doing wrong? (code follows)

 

/*

Simple Code to use an L1862 LED diasplay with the MSP430
Tested with MSP430 2012 with IAR Embedded Workbench IDE
This code will display "MSP430 + L1682" on the top row of the LCD
and "www.nighsoft.com" on the bottom row.

Author: Michael Bok of www.nighsoft.com
Date: 1-11-09

See L1682_pinout.pdf and KS0066.pdf

On the L1682...
Pin 1 (Vss) = Ground
Pin 2 (Vdd) = 5V
Pin 3 (Vlc) = Ground
Pin 4 (RS) = MSP430 P1.4
Pin 5 (RW) = MSP430 P1.5
Pin 6 (E) = MSP430 P1.6
Pin 7 (DB0) = nothing
Pin 8 (DB1) = nothing
Pin 9 (DB2) = nothing
Pin 10 (DB3) = nothing
Pin 11 (DB4) = MSP430 P1.0
Pin 12 (DB5) = MSP430 P1.1
Pin 13 (DB6) = MSP430 P1.2
Pin 14 (DB7) = MSP430 P1.3
Pin 15 (Va) = nothing
Pin 16 (Vc) = nothing

*/

#include "msp430g2231.h"

//Set pins appropriately
#define DB4 0x01
#define DB5 0x02
#define DB6 0x04
#define DB7 0x08

#define RS 0x10
#define RW 0x20
#define E 0x40

//shouldn't need changed
#define LINE_1_ADDRESS 0x00
#define LINE_2_ADDRESS 0x40

void pause();
void pulse_e();
void send_nibble(unsigned char data);
void send_data(unsigned char data);
void init_L1682();
void test_L1682();

int main()
{
 // Stop watchdog timer
 WDTCTL = WDTPW + WDTHOLD;

 //set pins for output
 P1DIR = 0x00 | DB4 | DB5 | DB6 | DB7 | RS | RW | E;

 //set All low (may not be needed)
 P1OUT = 0x00;

 //init the LCD
 init_L1682();

 //print out some text
 test_L1682();
}

void pause()
{
   volatile unsigned int i;

   i = 5000;
   do 
   {
     i--;
   }
   while (i != 0);  
}

void pulse_e()
{
 //set e high
 P1OUT |= E;

 //pause
 pause();

 //set e low
 P1OUT &= ~E;

 //pause
 pause();
}

void send_data(unsigned char data)
{
 //send high part first
 send_nibble((data>>4) & 0x0F);
 send_nibble(data & 0x0F);
}

void send_nibble(unsigned char data)
{
 //convert the nibble to the appropriate pins
 if(data & 0x01)
   P1OUT |= DB4;
 else
   P1OUT &= ~DB4;

 if(data & 0x02)
   P1OUT |= DB5;
 else
   P1OUT &= ~DB5;

 if(data & 0x04)
   P1OUT |= DB6;
 else
   P1OUT &= ~DB6;

 if(data & 0x08)
   P1OUT |= DB7;
 else
   P1OUT &= ~DB7;

 pulse_e();
}

void init_L1682()
{
 //Make RS and RW 0
 P1OUT &= ~RS;
 P1OUT &= ~RW;
 P1OUT &= ~E;

 //pause for the powering of the LCD
 pause();
 pause();
 pause();
 pause();

 //needed?
 send_nibble(0x03);
 send_nibble(0x03);
 send_nibble(0x03);

 //Function Set
 send_nibble(0x02);
 send_nibble(0x02);
 send_nibble(0x0F);

 //Display On
 send_nibble(0x00);
 send_nibble(0x0F);

 //Display Clear
 send_nibble(0x00);
 send_nibble(0x01);

 //Entry Mode
 send_nibble(0x00);
 send_nibble(0x06);

}

void test_L1682()
{
 //move one spot in on top line
 P1OUT &= ~RS;
 P1OUT &= ~RW;
 send_data(0x80 | (LINE_1_ADDRESS + 1));

 //Make RS 1 and RW 0
 P1OUT |= RS;
 P1OUT &= ~RW;
 send_data('M');
 send_data('S');
 send_data('P');
 send_data('4');
 send_data('3');
 send_data('0');
 send_data(' ');
 send_data('+');
 send_data(' ');
 send_data('L');
 send_data('1');
 send_data('6');
 send_data('8');
 send_data('2');


 //move to bottom line
 P1OUT &= ~RS;
 P1OUT &= ~RW;
 send_data(0x80 | LINE_2_ADDRESS);

 //bottom text
 P1OUT |= RS;
 P1OUT &= ~RW;
 send_data('w');
 send_data('w');
 send_data('w');
 send_data('.');
 send_data('n');
 send_data('i');
 send_data('g');
 send_data('h');
 send_data('s');
 send_data('o');
 send_data('f');
 send_data('t');
 send_data('.');
 send_data('c');
 send_data('o');
 send_data('m');
}

Link to post
Share on other sites

Doc,

Are you using CCS? If so, make sure under project settings or something like that (it's been a while... haven't had any MSP time lately) that under runtime library it's not marked as "none - assembly only". The option you want is something like "automatically determine". I had that problem once, turns out that there's a runtime library that's linked in with the programs when you're using CCS's compilers, and without it, the compiler has no idea even what main() is.

 

Hope this helps... but if not, I tried :P

Link to post
Share on other sites
Copy Your code into an old, fully functioning project. You may have accidentally overwritten something in the default settings ...

Thanks, nobody! That got it working. I obviously screwed something up! :?

 

I'll have to figure it out at some point, or be doomed to copying projects forever! Well, this computer is due for a reinstall of the OS anyway.

 

FORWARD with the project! :D

Link to post
Share on other sites
Copy Your code into an old, fully functioning project. You may have accidentally overwritten something in the default settings ...

Thanks, nobody! That got it working. I obviously screwed something up! :?

 

I'll have to figure it out at some point, or be doomed to copying projects forever! Well, this computer is due for a reinstall of the OS anyway.

 

FORWARD with the project! :D

 

diff -yib --suppress-common-lines working.c nonwork.c

 

Alternatively, there is a -p switch, which works with C files and functions.

 

-p --show-c-function

Show which C function each change is in.

Link to post
Share on other sites
diff -yib --suppress-common-lines working.c nonwork.c

 

Alternatively, there is a -p switch, which works with C files and functions.

 

-p --show-c-function

Show which C function each change is in.

Thanks, but a couple problems with your suggestion:

1. I'm not on Linux (Really would like to be, but several must-haves holding me back.)

2. The same code file works when transplanted to an old project, so it's in the build settings, not the code. The diff you suggest would return nothing. I suppose I could diff all the build files to find the problem, but that wouldn't tell me where to change it in CCS (if it wasn't obvious) to fix future default configurations.

Link to post
Share on other sites

I think the problem is with one of the files in the Debug folder, like XXX.map, or other project files, .cdtXXXX, did you compare them with the ones in working project?

It's clearly about missing symbol.

What happens when you rename your problem source file to something else, XXX.cx, and create new source with some simple program?

Link to post
Share on other sites
I think the problem is with one of the files in the Debug folder...

On "nobody's" recommendation, I duplicated a working project and copied the code to that. The code loads and works fine now.

 

I did try diffing several of the files and, although there were several differences, nothing jumped out at me as the source of the problem. To be honest, at this point, I have a working project, so I have little motivation to go hunting for the problem at this time. ;)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...