Forum Replies Created

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • in reply to: RPM sensing using hall effect sensor #11532
    sandeep
    Participant

    Hi Ligo,

    First of all, i would like to thank you for such a worthy platform to share ideas. i wish electrosome to be a big success.on my side, i have decided to buy the required electronic components from electrosome from now on.

    As far as speed control of dc motor using pwm module of pic16f877a on ur site is working good. i could control speed of a 5v motor. and actually i need to control the 24v dc motor, is uln2803 driver and a 24v dc relay with the 24v supply is sufficient or do v have to use triac application in it???

    Regards
    N.Sandeep

    in reply to: Retrieving UART data on LCD using PIC16F877A #11086
    sandeep
    Participant

    Hi sir,

    code is concerned, i m trying to debug the code from the basics, the basic code is as shown below, I tried it with the led’s, like,
    if the format is correct then RB1 to blink or else RB3 to blink, but it is not happening.suggestions pls.

    void main()
    {
      //unsigned char data;
      TRISC = 0xC0;
      TRISB = 0x00;
      TRISD = 0x00;
      PORTC = 0x00;
      PORTD = 0x00;
      PORTB = 0x00;
    
      UART_Init();
      Lcd4_Init();
      delay(500);
      GIE = 1;
      PEIE = 1;
      char i,c;
      int j,k,l;
    
      delay(6000); //delay provided for the gsm to get signal stable.
    
      RCREG = 0;
      UART_Write_Text("AT+CMGF=1");
      UART_Write(0x0D);
      UART_Write(0x0A);
    
      UART_Write_Text("AT+CNMI=2,0,0,0,0"); // as suggested by u sir, but as per datasheet, it might be 2,1,0,0,0
      UART_Write(0x0D); // it remains same even after changing to AT+CNMI=2,1,0,0,0
      UART_Write(0x0A);
    
      while(RCIF) // checking data ready
      {
        for(i=0;i<=64;i++)
        {
          x[i]=UART_Read();
        }
    
        if(x[2]=='+'&& x[3]=='C')
        {
          RB1 = 1;
          lcd4_delayms(1000);
          RB1 = 0;
        }
        else if(x[2]!='+'&&x[3]!='C')
        {
          RB3 = 1; 
          lcd4_delayms(1000);
          RB3 = 0;
          RCREG=0;
        }
        continue;
      }
      i=0;
      x[i]=0;
    
      RCREG=0;
    
      delay(1000);
    }
    
    in reply to: Retrieving UART data on LCD using PIC16F877A #11064
    sandeep
    Participant

    Hi sir,

    As i tried, code entering the loop only if the RCIF flag is raised,with below code, the code enters the loop, and the data from rcreg is transfered to an array(checked using led blinking),but as i tried to test the +CMTI format to check for the new messages,like in the  second part of code.but as soon as it receives a message the +cmti response must be send to the controller, i.e RCREG, but it is not happening.suggestions pls.

    I am not sure, whether the +CMTI response is sent to controller or not. and my other doubt is whether the +CMTI response comes under the ECHO feature, because i have disabled the echo feature, will it be a reason for this??

    while(!RCIF)
    {
      RB2=1;                     //LED, which keeps blinking, loop working good.
      delay(2000);
      RB2=0;
      delay(2000);
    
      for(i=0;i<10;i++)
      {
        x[i]=RCREG;
      }
    
      if(x[0]=='+'|| x[1]=='+'||x[2]=='+'||x[3]=='+')     //+CMTI: "SM",1
      {
        RB1=1;                                 // testing this like x[0]!='+', then it works, so array is working good.
        delay(2000);
        RB1=0;
        delay(2000);
      }
      else continue;
    }
    
    in reply to: Retrieving UART data on LCD using PIC16F877A #11060
    sandeep
    Participant

    Hi sir,

    my doubt is, will the +cmti response comes under the gsm echo feature? becoz, as i could read the message and display it on lcd using the AT+CMGR=1, why cant we do it replacing the CMGR with CNMI and wait for the +CMTI response to be displayed on the lcd, as in both the cases, the RCIF plays the main role.

     

     

    in reply to: Retrieving UART data on LCD using PIC16F877A #11040
    sandeep
    Participant

    Hi sir,

    I just want to read only the new messages, as i test the gsm module with the hyperterminal, we get the indication for the new message in

    the form of +CMTI: “SM”,1,  and my doubt is how to use this in c code, so that the loop must wait until this response is received from the gsm module,

    where after that,  comparing the required bit,mode of motor operation can be decided.

    in reply to: PWM by pic 16F877A #10953
    sandeep
    Participant

    Hi Ligo,

    As i also have problem on pwm,  so i thought posting my doubt over here is fine.but i work on mplab.

    I just tried to run a pwm with the duty cyle of 78% of the period, but it is not working on proteous, suggestions pls.

    void main()
    {
      PR2=0xFF;//setting period=0.0002048
      CCP1CON=0b00001100;//setting to pwm mode<3:0> and duty value<5:4>
      CCPR1L=0xC8;    //setting value of 800 to make duty=0.00016,which
      //is 78% of period.
      //T2CON=0b00000001;//prescale<1:0> of1:4
      T2CKPS0=1;
      T2CKPS1=0;
      TMR2ON=1;       //timer2 is on i.e clock pulses are provided.
    }
    
    in reply to: Retrieving UART data on LCD using PIC16F877A #10827
    sandeep
    Participant

    sorry sir, my mistake… finally i got what required… no conversion was needed to display data from gsm on lcd. i got what exactly i got on hyperterminal now…
    but as per the code below… loop is not getting repeated continuosly. i just mentioning last three bits for reference..

    while(1)
    {
      UART_Write_Text("AT+CMGR=1");
      UART_Write(0x0D);
      UART_Write(0x0A);
    
      for(i=0;i<67;i++)
      {
        x[i]=UART_Read();
      }
    
      Lcd4_Clear();
      Lcd4_Set_Cursor(1,1);
      lcd4_putch(x[63]);  // data corresponding bit
      lcd4_putch(x[64]);
      lcd4_putch(x[65]);
    }
    
    in reply to: Retrieving UART data on LCD using PIC16F877A #10813
    sandeep
    Participant

    Hi sir,

    i also have the same doubt sir but printing without converting gives me an undefined symbols…and i get alphabets only

    once i convert using 0x30,but which are not the one i get on hyperterminal… should i check on baud rates???

    in reply to: Retrieving UART data on LCD using PIC16F877A #10784
    sandeep
    Participant

    Hi sir,

    As i copy data from RCREG to an array, i tried to convert the data to an ascii by adding 0x30 and 0x40 and print it on lcd. but i get

    random alphabets and symbols which doesnt match with what i get it on hyperterminal.is that due to baud rate???

    code used:

    Lcd4_Clear();
    Lcd4_Set_Cursor(1,0);
    lcd4_putch((x[0]+0x30));  // if its giving unknown char ,add 0x40 to x[0] and try(HEX to ascii)
    lcd4_putch((x[1]+0x30));
    lcd4_putch((x[2]+0x30));
    lcd4_putch((x[3]+0x30));

    in reply to: Retrieving UART data on LCD using PIC16F877A #10723
    sandeep
    Participant

    yes sir… i copied once received from rcreg… and printed only needed part on lcd…

    in reply to: Retrieving UART data on LCD using PIC16F877A #10713
    sandeep
    Participant

    hi,

    I must thank the forum for helpful suggestions posted. now the module has worked somewhat good, now by sending command AT i could see OK printed on the lcd screen. now to read the first msg using AT+CMGR=1; i receive data along with delivery OK and info s of the CMGR pattern, and my DOUBT is

    1. how to disable the delivery message and

    2. how to print only <data> out of RCREG format.
    +CMGR:<stat>,<oa>,[<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs>,<sca>,
    <tosca>,<length>]<CR><LF><data>

    in reply to: Retrieving UART data on LCD using PIC16F877A #10710
    sandeep
    Participant

    I have disabled the echo feature using ATE0 command and have put the gsm module permanently on the text mode using AT+CMGF=1;&W , and now i get the garbage character on the lcd display, when i tried the code with the hyperterminal, i got the same garbage value but once i create an interrupt by pressing a key on keyboard that gets printed on lcd, but when i interface the controller with the gsm module, the same garbage value is printed repeatedly… i have done a code to receive a one character first… so here is the code…and i tried with the electrosome ‘s udf’s this time

    do
    {
      UART_Write_Text("AT");
      UART_Write(0x0D);   //CR.
      UART_Write(0x0A);   //NEW LINE.
      
      delay(2000);
    
      if(UART_Data_Ready())
      {
        /*if(OERR)
        {
          CREN = 0;
          CREN = 1;
        }*/
        x[0]=UART_Read();
        RCREG=0;
      }
      Lcd4_Clear();
      Lcd4_Set_Cursor(1,4);
      lcd4_putch(x[0]);
      delay(500);
      Lcd4_Clear();
    }while(1);
    /*UDF*/
    char UART_Data_Ready()
    {
      return RCIF;
    }
    
    char UART_Read()
    {
      while(!RCIF);
      return RCREG;
    }
    
    in reply to: Retrieving UART data on LCD using PIC16F877A #10703
    sandeep
    Participant

    First of all… thanks for your response sir.

    As i tested the code with the hyperterminal…i could see the AT command printed on the terminal and as i press a key on the keyboard that gets printed on the lcd screan… so serial comm is of no problem.but when i interface pic with the gsm module. instead of getting OK i getback same command what i send(AT) on the lcd screan. suggestions pls.

     

     

     

Viewing 13 posts - 1 through 13 (of 13 total)
>