10.07.2015 Views

cubloc_manual2.pdf

cubloc_manual2.pdf

cubloc_manual2.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example다음은 CB280 와 EEPROM 24LC32 를 연결하여 EEPROM 의 특정번지에 값을 써넣었다가 읽어서 DEBUG 창에 표시해주는 샘플 프로그램입니다.Const Device = cb280Dim adr As IntegerDim data As ByteDim a As Bytedata = &ha1adr = &h3Set I2c 3,2Do‘ 1 바이트 쓰기I2cstartIf I2cwrite(&b10100000)= 1 Then Goto err_proca=I2cwrite(adr.byte1)a=I2cwrite(adr.lowbyte)a=I2cwrite(data)I2cstopDelay 1000‘ 1 바이트 읽기I2cstarta=I2cwrite(&b10100000)a=I2cwrite(adr.byte1)a=I2cwrite(adr.lowbyte)I2cstarta=I2cwrite(&b10100001)a=I2cread(0)I2cstop‘ 결과 표시Debug Hex a,crDelay 500Looperr_proc:Debug "Error !"DoLoop24LC32CB280A0A1A2SCLSDAP2P3247

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!