Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

c code

Options
  • 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