Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

STMicro STM8S-Discovery USB EVBU (under $10) ???

Status
Not open for further replies.
Had a little project with a fully automatic wood chopper. Tried two weeks to get at PIC 16F866 working but only get troubles. Find this STM8 Discovery evaluation board. With a couple of IDC connectors and about four hours working time the project was up and running.
Total cost under 200 Swedish kronor (under 25 USD).
Yes, Microchip data sheet is better than STM but that doesn't matter. The thing that matters is the hours spent from start to finish. For small projects this board is perfect. I bought two more, one for spare part and one to play with.
 
Still under $10 heh. I still have my board. I feel setting it up again and seeing if i can get it working again. I dont know why i stopped using it at all but heh.
 
Thank you, AtomSoft for sample code 2x16 LCD but I have a good solution to interface please see my code as below:
Code:
//lcd.h
#include "stm8s.h"

#define LCD_PORT   GPIOE
#define LCD_RS       GPIO_PIN_7
#define LCD_RW      GPIO_PIN_6
#define LCD_E       GPIO_PIN_5

#define lcd_type 2        // 0=5x7, 1=5x10, 2=2 lines
#define lcd_line_two 0x40 // LCD RAM address for the 2nd line
#define DISPLAY_CLR        ((u8)0x01)
#define TEST_STR  "TEST RUN STM8Sxx"
#define TEST_TR2  "     KANA_RD    "

u8 const LCD_INIT_STRING[4] =
{
    0x20 | (lcd_type << 2), // Func set: 4-bit, 2 lines, 5x8 dots
    0xc,                    // Display on
    0x01,                   // Clear display
    0x06                    // Increment cursor
 };


void init_lcd(void);
void delay_ms(u16 delay);
void lcd_send_byte(u8 dat,u8 type);
void lcd_send_nibble(u8 nyb, u8 type);
void lcd_line(u8 line);
void lcd_send_string(const u8 *text, u8 line);
void lcd_clear(void);

void testLCD(void) 
{
    lcd_send_string(TEST_STR, 1);
    delay_ms(10);
    lcd_send_string(TEST_TR2, 2);
    delay_ms(10);
    
}

void lcd_send_string(const u8 *text, u8 line)
{
    lcd_line(line);
    while(*text) lcd_send_byte(*text++,1);
}

void init_lcd(void)
{
    GPIOE->ODR &= (u8)(~LCD_E);         //clear enable
    GPIOE->ODR &= (u8)(~LCD_RS);        //going to write command

   delay_ms(30);
   for(i=0 ;i < 3; i++)
   { 
      lcd_send_nibble(0x03,0);
      delay_ms(1);   //5
   }
   lcd_send_nibble(0x02,0);

   for(i=0; i < sizeof(LCD_INIT_STRING); i++)
   {
      lcd_send_byte(LCD_INIT_STRING[i],0);
   }
}

void lcd_send_byte(u8 dat, u8 type)
{
    delay_ms(1);                         //TEST LCD FOR BUSY 
    lcd_send_nibble(dat>>4,type);               //WRITE THE UPPER NIBBLE
    lcd_send_nibble(dat,type);                  //WRITE THE LOWER NIBBLE
}

void lcd_send_nibble(u8 nyb, u8 type)
{
    unsigned char temp = (nyb & 0x0F);
    GPIOE->ODR = temp;
        
    if(type == 0) GPIOE->ODR &= (u8)(~LCD_RS); //COMMAND MODE
    else GPIOE->ODR |= (u8)(LCD_RS);           //CHARACTER/DATA MODE        
    GPIOE->ODR |= (u8)(LCD_E);                 //ENABLE LCD DATA LINE
    delay_ms(1);                               //SMALL DELAY
    GPIOE->ODR &= (u8)(~LCD_E);                //DISABLE LCD DATA LINE
}

void lcd_line(u8 line)
{
    switch(line)
    {
        case 0:
        case 1: lcd_send_byte(0x80,0);
                break;
        case 2: lcd_send_byte(0xC0,0);
                break;
    }
}

//----------------------------- 
void lcd_clear(void) 
{ 
    lcd_send_byte(DISPLAY_CLR,0);
    delay_ms(2);
}

    void delay_ms(u16 delay)
    {
        u16 nCount = 0;
        while (delay != 0){
            nCount = 2560;
            while (nCount != 0){
                nCount--;
            }
            delay--;
        }
    }

// and used main function as :

#include "stm8s.h"
#include <string.h>
#include <ctype.h>

#include "lcd.h"

void main(void)
{
    /* Port E config IO */
    GPIO_DeInit(LCD_PORT);
    GPIO_Init(LCD_PORT, GPIO_PIN_ALL, GPIO_MODE_OUT_PP_LOW_FAST);
    init_lcd();
    testLCD(); 
     while(1);
}
 
Last edited by a moderator:
Ultra Low powr STM8L discovery kit

Hello Guys,
Does anyone tryed the STM8L-Discovery ? This is the Ultra low power version of this kit.
It comes with an LCD on board. I will be interested to have some examples.

Thanks a lot.
Nakim.:)
 
Nice thread. I bought STM8S discovery a while ago but haven't tried yet. Want to try LCD demo now. It looked simple and nice they have some library support for it.

BTW, did you know they have now also 32 but version of this (STM32 Discovery) for the same low price - 8 EUR. I bought that as well as it was so cheap :) And it has more flash and more peripherals. I'm wondering if it's possible to reuse examples from 8 but version as it seams there might be more guides and samples out there for STM8 than for STM32.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top