brymen_bm869s_ir_cable

Brymen 869s Serial PC-Comm DIY Cable.
git clone htps://git.onna.be/brymen_bm869s_ir_cable.git
Log | Files | Refs

commit 111d1919d65f87bb1107dcb6543c6181eb71bb1e
parent 69aeec245a8a8dfd8f3a16cd98b31ee8c9cc80de
Author: Paco Esteban <paco@onna.be>
Date:   Wed,  5 Dec 2018 10:45:32 +0100

first working version + some comments and small fixes

Diffstat:
firmware/bm869s.h | 2--
firmware/main.c | 23++++++++++++++++-------
firmware/main.hex | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 9 deletions(-)

diff --git a/firmware/bm869s.h b/firmware/bm869s.h @@ -86,5 +86,3 @@ #define NUMBER_7 0xa8 #define NUMBER_8 0xfe #define NUMBER_9 0xfc - -char Decode_7seg ( unsigned char val ); diff --git a/firmware/main.c b/firmware/main.c @@ -32,11 +32,15 @@ unsigned char getByte( void ) { unsigned char result, mask; + // bit by bit check (using shift mask) + // clock --> check --> "unclock" for ( mask = 1, result = 0; mask != 0; mask <<= 1 ) { digitalWrite( IRTX, HIGH ); _delay_us( 250 ); - if ( PINB & ( 1 << IRRX ) ) result |= mask; + // checking on low instead of high, so maybe we can reuse + // some work done on eevblog forum + if ( digitalRead( IRRX ) == LOW ) result |= mask; digitalWrite( IRTX, LOW ); _delay_us( 250 ); @@ -51,13 +55,16 @@ int readBM689s ( void ) unsigned int timeout; unsigned char j; - while ( IRRX == HIGH ); + // wait in case dmm is transmitting already + while ( digitalRead( IRRX ) == HIGH ); + // init communication 10ms pulse digitalWrite( IRTX, HIGH ); _delay_ms( 10 ); digitalWrite( IRTX, LOW ); timeout = 0; + // wait for dmm response while ( digitalRead( IRRX ) == LOW ) { _delay_ms( 1 ); timeout++; @@ -65,6 +72,7 @@ int readBM689s ( void ) if ( timeout > 1000 ) break; } + // if we did not reach timeout, get 20 bytes. if ( timeout <= 1000 ) { for ( j = 0; j < BM_PBYTES; j++ ) bm[j] = getByte(); @@ -294,6 +302,7 @@ void Send_Disp2 ( void ) } } + // Frequency if ( bm[13] & Hz_2 ) { if ( ( bm[13] & k_2 ) || ( bm[13] & M_2 ) ) { printc( 'E' ); @@ -321,11 +330,11 @@ int main( void ) while ( 1 ) { readBM689s(); - /* Send_Disp1(); */ - /* Send_Disp2(); */ - - for ( unsigned char j = 0; j < BM_PBYTES; j++ ) printc( bm[j] ); - + Send_Disp1(); + printc( ' ' ); + Send_Disp2(); + printc( '\r' ); + printc( '\n' ); _delay_ms( 200 ); } diff --git a/firmware/main.hex b/firmware/main.hex @@ -0,0 +1,73 @@ +:100000000EC01DC01CC01BC01AC019C018C017C02C +:1000100016C015C014C013C012C011C010C01124E6 +:100020001FBECFE5D2E0DEBFCDBF20E0A0E6B0E04E +:1000300001C01D92A437B207E1F706D21BC2E0CF80 +:1000400020E035E1F894B89AC09808B293E0232FE5 +:100050002A95F1F780FB00F89695879508BAB9F7CD +:10006000089528E030E091E080E0C39AE3EFF1E00A +:100070003197F1F700C00000B29B892BC398E3EFE2 +:10008000F1E03197F1F700C00000990F21503109DC +:1000900061F70895CF93DF9386B3C39A8FE19EE40F +:1000A0000197F1F700C00000C39889EE93E0B29B7E +:1000B0000DC0C0E6D0E0D5DF8993F0E0C437DF079C +:1000C000D1F781E090E0DF91CF910895EFECF7E078 +:1000D0003197F1F700C00000019749F790E080E008 +:1000E000F2CF8E7F8E37B1F1C0F48032A9F140F4A7 +:1000F0008631A1F18E31A1F18823A1F18FE308951A +:100100008E3491F120F48034C9F78DE2089582375E +:1001100069F18C3799F785E30895843E49F168F4D5 +:10012000883A41F120F4803A49F781E308958E3B03 +:1001300019F18A3D19F782E30895883FF9F020F418 +:10014000823FE1F684E608958C3FD1F08E3FB1F610 +:1001500088E3089586E3089589E608958CE4089578 +:1001600083E4089580E2089586E408958FE6089573 +:1001700084E3089587E3089580E3089583E3089571 +:1001800089E3089590916E0097FD0CC080916D00F9 +:1001900080729171892B31F48091610087FDC2C01A +:1001A0008BE24EDF809162009CDF4ADF809163002A +:1001B00080FF02C08EE244DF8091630092DF40DF67 +:1001C0008091640080FF02C08EE23ADF809164007B +:1001D00088DF36DF8091650080FF02C08EE230DF6D +:1001E000809165007EDF2CDF8091660080FF02C079 +:1001F0008EE226DF8091660074DF22DF8091670047 +:1002000070DF803209F01CDF8091670080FD04C040 +:1002100080916D0087FF26C080916E008C7051F038 +:1002200085E40EDF8DE20CDF80916E0082FD7CC0E4 +:1002300086E306DF80E204DF8091670080FF76C0FE +:1002400086E5FEDE8091610081709091600094FFF0 +:1002500073C0882309F46CC082E5F2DE8DE4F0DE21 +:1002600083E5EEDE80916E0080FF12C0807651F053 +:1002700085E4E6DE8BE2E4DE80916E0086FF61C0FD +:1002800083E3DEDE80E2DCDE88E4DADE8AE7D8DEE5 +:1002900080916E0087FF06C080E2D2DE84E4D0DE6B +:1002A00085E2CEDE80916E0081FF0CC080E2C8DE68 +:1002B00084E6C6DE82E4C4DE80916E0082FF02C066 +:1002C0008DE6BEDE80916E0084FF14C0807651F012 +:1002D00085E4B6DE8BE2B4DE80916E0086FF33C02B +:1002E00083E3AEDE80E2ACDE8FE4AADE88E4A8DE43 +:1002F0008DE4A6DE90916D0095FF31C080916E0077 +:100300008C709074892B51F085E49ADE8DE298DE32 +:1003100080916D0086FF19C089E392DE80E290DE55 +:1003200086E48ECE8DE23DCF83E383CF81E489CF17 +:1003300084E486DE83E495CF882309F493CF81E4B7 +:10034000F8CF86E39ECF86E3CCCF80916E0083FF0B +:1003500002C086E3E2CF82FFE1CF83E3DECF0895E0 +:1003600080916900BEDE803209F46DC08091680022 +:1003700084FD5FC08BE264DE80916900B2DE60DEE6 +:1003800080916A0080FF02C08EE25ADE80916A008E +:10039000A8DE56DE80916B0080FF02C08EE250DE48 +:1003A00080916B009EDE4CDE80916C0080FF02C06D +:1003B0008EE246DE80916C0094DE42DE9091680011 +:1003C00080916D008870292F2470822BE1F093704A +:1003D00051F085E435DE8DE233DE8091680081FDE9 +:1003E0002AC086E32DDE80E22BDE80916D0083FF44 +:1003F00024C086E525DE8091680085FF20C081E469 +:100400001FDE83E41DDE80916D0082FF1CC08370BF +:1004100051F085E415DE8BE213DE80916D0081FFE3 +:1004200010C083E30DDE80E20BDE88E409DE8AE79C +:1004300007CE8DE2A0CF83E3D5CF81E4DBCF84E488 +:10044000DFCF86E3EFCF0895BB9ABA98C39822DE38 +:1004500099DE80E2F5DD84DF8DE0F2DD8AE0F0DD1B +:100460002FEF81EE94E0215080409040E1F700C0F2 +:080470000000EDCFF894FFCF6E +:00000001FF