Skip to content

Instantly share code, notes, and snippets.

View ossicode's full-sized avatar

OSSI ossicode

View GitHub Profile
@ossicode
ossicode / main.c
Created December 26, 2012 12:03
I2C, UART, ADC all using ACLK in LPM3 mode, working
/*
* main.c
*/
#include "ossibeacon.h"
#include "printf.h"
unsigned int RxByteCtr;
unsigned int RxWord;
@ossicode
ossicode / aclkuart.c
Created December 29, 2012 11:06
ADC module almost done
/*
* aclkuart.c
*
* Created on: 2012. 12. 19.
* Author: OSSI
*/
#include "aclkuart.h"
static volatile uint8_t uart_rx_flag = 0;
static volatile uint8_t rx_byte = '\0';
@ossicode
ossicode / aclkuart.c
Created December 29, 2012 14:01
ADC, Timer, Uart working example.all ACLK, LPM3 DCO 8MHz 타이머가 한번씩 켜지면서 ADC 채널 바꿔가면 샘플링하고 결과를 UART로 뿌려준다.
/*
* aclkuart.c
*
* Created on: 2012. 12. 19.
* Author: OSSI
*/
#include "aclkuart.h"
static volatile uint8_t uart_rx_flag = 0;
static volatile uint8_t rx_byte = '\0';
@ossicode
ossicode / aclkuart.c
Created December 31, 2012 10:17
I2C Test version Master Receiver.
/*
* aclkuart.c
*
* Created on: 2012. 12. 19.
* Author: OSSI
*/
#include "aclkuart.h"
static volatile uint8_t uart_rx_flag = 0;
static volatile uint8_t rx_byte = '\0';
@ossicode
ossicode / aclkuart.c
Created January 2, 2013 12:36
I2C master TX RX almost done . when using slow aclk 32.768kHz for i2c clock source aclk /4 or aclk /8 is used but you need to check START condition is done before ucbbusy check. for SMCLK / 80 = 100kbps ucbbusy check is enough. strange but when i2c clock is too slow, START condition starts slow, so we need to to wait longer
/*
* aclkuart.c
*
* Created on: 2012. 12. 19.
* Author: OSSI
*/
#include "aclkuart.h"
static volatile uint8_t uart_rx_flag = 0;
static volatile uint8_t rx_byte = '\0';
@ossicode
ossicode / i2c.c
Created January 2, 2013 13:59
temporary i2c master and slave all together. master mode is still working
/*
* i2c.c
*
* Created on: 2012. 12. 30.
* Author: OSSI
*/
// we implement I2C as below:
//
// 7 bit addressing mode
@ossicode
ossicode / aclkuart.c
Created January 4, 2013 10:46
i2c test
/*
* aclkuart.c
*
* Created on: 2012. 12. 19.
* Author: OSSI
*/
#include "aclkuart.h"
static volatile uint8_t uart_rx_flag = 0;
static volatile uint8_t rx_byte = '\0';
@ossicode
ossicode / main.c
Created January 4, 2013 13:19
msp430f1611 i2c master receiver test
#include "msp430f1611.h"
#include "ossitypes.h"
/*
* main.c
*/
uint8_t RXData = 0;
uint8_t TestData[64] = {0};
volatile uint8_t cnt;
int main (void)
{
@ossicode
ossicode / aclkuart.c
Created January 4, 2013 13:19
msp430f2132 slave transmitter test. almost done. some glitches but working fine.
/*
* aclkuart.c
*
* Created on: 2012. 12. 19.
* Author: OSSI
*/
#include "aclkuart.h"
static volatile uint8_t uart_rx_flag = 0;
static volatile uint8_t rx_byte = '\0';
@ossicode
ossicode / main.c
Created January 5, 2013 09:57
Master Tx and Rx MSP430F1611: Slave의 내부 주소를 0~7로 변경하면서 8 바이트 씩 쓰고 한번 8바이트 쓸때 마다 8 바이트 읽어와서 쓴값하고 비교 / 가져온 값이 틀리면 LED 토글
#include "msp430f1611.h"
#include "ossitypes.h"
/*
* main.c
*/
uint8_t RXData = 0;
uint8_t TxData[9] = {0};
uint8_t RxData[8] = {0};
volatile uint8_t cnt;
volatile uint8_t flag;