Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

c code

  • 21-03-2006 12:52PM
    #1
    Closed Accounts Posts: 41


    purchased a mikroelectronika board as a hobby as i am trying to get into programming,i have read a few books on c programming and visual basic aswell.

    ok what i want to do be able to do is for my mikroC code to recognise different commands i send to it in visual basic.

    For example if i send down the string PWM i want it to do PWM etc

    To get me started i want my board to recognise the string HELLO and display it on the LCD

    Here is my code but i am having alot of trouble getting it to work:


    i want to type PWM into textbox3



    Private Sub Command7_Click()
    MSComm1.PortOpen = True

    'this loop will send the ascii value for each character in the textbox
    For i = 1 To Len(Text3.Text)
    MSComm1.Output = Text3.Text
    buffer = Asc(Mid(Text3.Text, i, 1))

    Text3.Text = Text3 + buffer
    Next

    MSComm1.PortOpen = False
    End Sub


    Then PWM displays onto the LCD screen and PWM is performed
    char text;

    void main()
    {
    USART_init(2400);
    LCD_Init(&PORTB); // Initialize LCD connected to PORTB

    LCD_Cmd(LCD_CLEAR); // Clear display

    while(1)

    //LCD_Cmd(LCD_CURSOR_OFF); // Turn cursor off
    if (USART_Data_Ready())
    {
    text = USART_Read(); // if data is received
    // Print text to LCD, 2nd row, 1st column
    LCD_Out(2,6,text); // i want hello to display here
    Delay_ms(1000);
    LCD_Cmd(LCD_CLEAR);

    i put my PWM code here
    }

    THANK you


Advertisement