Shop OBEX P1 Docs P2 Docs Learn Events
Unable to display count on LCD display — Parallax Forums

Unable to display count on LCD display

I am trying to display a count on a LCD display. I have worked with Basic Stamp II since they came out, but this is my 1st time for the Propeller chip using SimpleIDE
The following is a copy of my code.
#include "simpletools.h" // Include simpletools
const int ON = 254;
const int CLR = 1;

int main() // main function
{

serial *lcd = serial_open(12, 12, 0, 9600); //Pin12
writeChar(lcd, ON);
writeChar(lcd, CLR);
pause(5);
int cycles = count(16,1000); // Count for 1 second Pin16
pause(10);
dprint(lcd,"count=", cycles);

pause(10);
}

Your assistance will be appreciated.
Dave

Comments

  • Here the code I used with my LCD display. I have the baud set to 19200 on my unit.
    #include "simpletools.h"
    
    #define ON 22
    #define OFF 21
    #define CLR 12
    #define LEFT 8
    #define RIGHT 9
    
    
    serial *s;
    int i;
    
    int main()
    {
      
      s = serial_open(0, 0, 0, 19200);
      
      writeChar(s, ON);
      writeChar(s, CLR);
      
      dprint(s, "Hello");
      
      while(1)
      {
        pause(500);
        
      }  
    }
    

    Mike

  • Mike, I have no problem getting the text of Count= to come up on my display. What I can not get to respond is the reading of the count input.
  • Ok, since the program only check once and then stops is it possible the pin is not changing when the program runs.
    while (1)
      {
        i = count(16, 1000);
        dprint(lcd, "count=%d", i);
        pause(1000);
      }
    

    Mike

  • Mike
    Thank you that worked
    Dave
  • Here some more fun code to try:
    #define PIN 16
    
    int main()
    {
    
      int Mask = 1 << PIN;
    
      waitpeq(0, Mask); //wait for low state
      printi("Pin Low\n");
      waitpne(0, Mask); //wait for high state
      printi("Pin High\n");
    }
    
    
Sign In or Register to comment.