![](/media/cache/group/download_IjbieK2.png.50x50_q85.png)
rs485 conversion
Dependencies: mbed
MicroCom.h@0:cc2f9ea8cd1f, 2019-06-16 (annotated)
- Committer:
- foxbrianr
- Date:
- Sun Jun 16 00:36:06 2019 +0000
- Revision:
- 0:cc2f9ea8cd1f
demo microcom
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
foxbrianr | 0:cc2f9ea8cd1f | 1 | /* |
foxbrianr | 0:cc2f9ea8cd1f | 2 | 1st Byte: Header byte: always 0x40. |
foxbrianr | 0:cc2f9ea8cd1f | 3 | |
foxbrianr | 0:cc2f9ea8cd1f | 4 | 2nd Byte: Is a bit field: free_a7 :1, bit 7 |
foxbrianr | 0:cc2f9ea8cd1f | 5 | Reserved (fire service) :1, bit 6 |
foxbrianr | 0:cc2f9ea8cd1f | 6 | Reserved :1, bit 5 |
foxbrianr | 0:cc2f9ea8cd1f | 7 | Reserved :1, bit 4 |
foxbrianr | 0:cc2f9ea8cd1f | 8 | Reserved :1, bit 3 |
foxbrianr | 0:cc2f9ea8cd1f | 9 | play strobe :1, bit 2 |
foxbrianr | 0:cc2f9ea8cd1f | 10 | arrival_dn_arrow :1, bit 1 |
foxbrianr | 0:cc2f9ea8cd1f | 11 | arrival_up_arrow :1, bit0 |
foxbrianr | 0:cc2f9ea8cd1f | 12 | |
foxbrianr | 0:cc2f9ea8cd1f | 13 | 3rd Byte: Scan_slot. zero is reserved, 1 through 254, (119 may be max value in some cases) |
foxbrianr | 0:cc2f9ea8cd1f | 14 | |
foxbrianr | 0:cc2f9ea8cd1f | 15 | 4th Byte: Message_number. zero is no message, 1 through 126, (63 may be max value in some cases) |
foxbrianr | 0:cc2f9ea8cd1f | 16 | |
foxbrianr | 0:cc2f9ea8cd1f | 17 | 5th Byte: Is a bit field: Rear arrival dn arr :1, bit 7 |
foxbrianr | 0:cc2f9ea8cd1f | 18 | Rear arrival up arr :1, bit 6 |
foxbrianr | 0:cc2f9ea8cd1f | 19 | Message level hi bit :1, bit 5 |
foxbrianr | 0:cc2f9ea8cd1f | 20 | Message level low bit :1, bit 4 |
foxbrianr | 0:cc2f9ea8cd1f | 21 | Passing chime :1, bit 3 |
foxbrianr | 0:cc2f9ea8cd1f | 22 | Reserved :1, bit 2 |
foxbrianr | 0:cc2f9ea8cd1f | 23 | traveling dn arrow :1, bit 1 |
foxbrianr | 0:cc2f9ea8cd1f | 24 | traveling up arrow :1, bit 0 |
foxbrianr | 0:cc2f9ea8cd1f | 25 | |
foxbrianr | 0:cc2f9ea8cd1f | 26 | 6th Byte: ASCII floor char, msb. |
foxbrianr | 0:cc2f9ea8cd1f | 27 | |
foxbrianr | 0:cc2f9ea8cd1f | 28 | 7th Btye: ASCII floor char, mid. |
foxbrianr | 0:cc2f9ea8cd1f | 29 | |
foxbrianr | 0:cc2f9ea8cd1f | 30 | 8thByte: ASCII floor char, lsb. |
foxbrianr | 0:cc2f9ea8cd1f | 31 | Note: floor ASCII range is 0x30 through 0x5a (‘0’ – ‘Z’). |
foxbrianr | 0:cc2f9ea8cd1f | 32 | 0x3a through 0x40 are special characters with |
foxbrianr | 0:cc2f9ea8cd1f | 33 | 0x3b being the space or blank character(semicolon) |
foxbrianr | 0:cc2f9ea8cd1f | 34 | 0x3d is normally displayed as a minus character. |
foxbrianr | 0:cc2f9ea8cd1f | 35 | 9th Byte: ASCII Mess. char, msb. |
foxbrianr | 0:cc2f9ea8cd1f | 36 | |
foxbrianr | 0:cc2f9ea8cd1f | 37 | 10th Byte: ASCII Mess. Char, mid. |
foxbrianr | 0:cc2f9ea8cd1f | 38 | |
foxbrianr | 0:cc2f9ea8cd1f | 39 | 11th Byte: ASCII Mess. char, lsb. |
foxbrianr | 0:cc2f9ea8cd1f | 40 | Note: message ASCII range is 0x30 through 0x5b (‘0’ – ‘[’). |
foxbrianr | 0:cc2f9ea8cd1f | 41 | 0x3a through 0x40 are special characters with |
foxbrianr | 0:cc2f9ea8cd1f | 42 | 0x3b being the space or blank character(semicolon) |
foxbrianr | 0:cc2f9ea8cd1f | 43 | 0x5d is sent when there is no message (instead of spaces). |
foxbrianr | 0:cc2f9ea8cd1f | 44 | So bytes 9, 10, and 11 will each be ‘[‘ when no message. |
foxbrianr | 0:cc2f9ea8cd1f | 45 | 12th Byte: checksum, two’s complement of bytes 1 through 11. |
foxbrianr | 0:cc2f9ea8cd1f | 46 | |
foxbrianr | 0:cc2f9ea8cd1f | 47 | Example: |
foxbrianr | 0:cc2f9ea8cd1f | 48 | 0x40, header |
foxbrianr | 0:cc2f9ea8cd1f | 49 | 0x01, up arrow for lantern |
foxbrianr | 0:cc2f9ea8cd1f | 50 | 0x01, floor number 1, |
foxbrianr | 0:cc2f9ea8cd1f | 51 | 0x03, message number 3 activated |
foxbrianr | 0:cc2f9ea8cd1f | 52 | 0x11, message level 1, direction arrow is up |
foxbrianr | 0:cc2f9ea8cd1f | 53 | 0x4c, ascii floor character ‘L’ |
foxbrianr | 0:cc2f9ea8cd1f | 54 | 0x42, ascii floor character ‘B, |
foxbrianr | 0:cc2f9ea8cd1f | 55 | 0x59, ascii floor character ‘Y’ |
foxbrianr | 0:cc2f9ea8cd1f | 56 | 0x3b, ascii message character ‘;’ for space or blank |
foxbrianr | 0:cc2f9ea8cd1f | 57 | 0x4e, ascii message character ‘N’ |
foxbrianr | 0:cc2f9ea8cd1f | 58 | 0x44, ascii message character ‘D’ |
foxbrianr | 0:cc2f9ea8cd1f | 59 | 0xf6, checksum (two’s complement). |
foxbrianr | 0:cc2f9ea8cd1f | 60 | */ |
foxbrianr | 0:cc2f9ea8cd1f | 61 | |
foxbrianr | 0:cc2f9ea8cd1f | 62 | class MicroComMessage |
foxbrianr | 0:cc2f9ea8cd1f | 63 | { |
foxbrianr | 0:cc2f9ea8cd1f | 64 | public: |
foxbrianr | 0:cc2f9ea8cd1f | 65 | uint8_t message[12]; |
foxbrianr | 0:cc2f9ea8cd1f | 66 | |
foxbrianr | 0:cc2f9ea8cd1f | 67 | uint8_t * getMessage(){ return message;}; |
foxbrianr | 0:cc2f9ea8cd1f | 68 | |
foxbrianr | 0:cc2f9ea8cd1f | 69 | |
foxbrianr | 0:cc2f9ea8cd1f | 70 | |
foxbrianr | 0:cc2f9ea8cd1f | 71 | void SetFloor(char* floor) {}; |
foxbrianr | 0:cc2f9ea8cd1f | 72 | |
foxbrianr | 0:cc2f9ea8cd1f | 73 | void SetMessage( char* msg){}; |
foxbrianr | 0:cc2f9ea8cd1f | 74 | |
foxbrianr | 0:cc2f9ea8cd1f | 75 | |
foxbrianr | 0:cc2f9ea8cd1f | 76 | |
foxbrianr | 0:cc2f9ea8cd1f | 77 | }; |
foxbrianr | 0:cc2f9ea8cd1f | 78 | |
foxbrianr | 0:cc2f9ea8cd1f | 79 | /* |
foxbrianr | 0:cc2f9ea8cd1f | 80 | Floor and Arrow Information (0x501) |
foxbrianr | 0:cc2f9ea8cd1f | 81 | The floor and arrow information contains the current car position and hall arrows. |
foxbrianr | 0:cc2f9ea8cd1f | 82 | Packet Data |
foxbrianr | 0:cc2f9ea8cd1f | 83 | Byte 1 |
foxbrianr | 0:cc2f9ea8cd1f | 84 | Front arrows |
foxbrianr | 0:cc2f9ea8cd1f | 85 | Bit 0 – Front arrival arrow up |
foxbrianr | 0:cc2f9ea8cd1f | 86 | Bit 1 – Front arrival arrow down |
foxbrianr | 0:cc2f9ea8cd1f | 87 | Bit 2 – Play Strobe |
foxbrianr | 0:cc2f9ea8cd1f | 88 | Bit 3-5 – Reserved |
foxbrianr | 0:cc2f9ea8cd1f | 89 | Bit 6 – Fire Warning Lamp |
foxbrianr | 0:cc2f9ea8cd1f | 90 | Byte 2 |
foxbrianr | 0:cc2f9ea8cd1f | 91 | Floor Number. A floor number of 0 is not a valid. |
foxbrianr | 0:cc2f9ea8cd1f | 92 | Byte 3 |
foxbrianr | 0:cc2f9ea8cd1f | 93 | Priority message number |
foxbrianr | 0:cc2f9ea8cd1f | 94 | Byte 4 |
foxbrianr | 0:cc2f9ea8cd1f | 95 | Travel and rear arrows |
foxbrianr | 0:cc2f9ea8cd1f | 96 | Bit 0 – Travel arrow up |
foxbrianr | 0:cc2f9ea8cd1f | 97 | Bit 1 – Travel arrow down |
foxbrianr | 0:cc2f9ea8cd1f | 98 | Bit 2 – unused |
foxbrianr | 0:cc2f9ea8cd1f | 99 | Bit 3 – Passing Chime |
foxbrianr | 0:cc2f9ea8cd1f | 100 | Bit 4 – Message Level Low Bit |
foxbrianr | 0:cc2f9ea8cd1f | 101 | Bit 5 – Message Level High Bit |
foxbrianr | 0:cc2f9ea8cd1f | 102 | Bit 6 – Rear arrival arrow up |
foxbrianr | 0:cc2f9ea8cd1f | 103 | Bit 7 – Rear arrival arrow down |
foxbrianr | 0:cc2f9ea8cd1f | 104 | Byte 5-8 |
foxbrianr | 0:cc2f9ea8cd1f | 105 | Reserved |
foxbrianr | 0:cc2f9ea8cd1f | 106 | */ |
foxbrianr | 0:cc2f9ea8cd1f | 107 | |
foxbrianr | 0:cc2f9ea8cd1f | 108 | void GetMessage501(char * floor, char * msg, char lantern ) |
foxbrianr | 0:cc2f9ea8cd1f | 109 | { |
foxbrianr | 0:cc2f9ea8cd1f | 110 | } |
foxbrianr | 0:cc2f9ea8cd1f | 111 | /* |
foxbrianr | 0:cc2f9ea8cd1f | 112 | Floor and Message characters (0x502) |
foxbrianr | 0:cc2f9ea8cd1f | 113 | The floor and message characters packet contains the marking used to represent the floor or priority message on displays. |
foxbrianr | 0:cc2f9ea8cd1f | 114 | Packet Data |
foxbrianr | 0:cc2f9ea8cd1f | 115 | Byte 1 Floor marking character (leftmost) |
foxbrianr | 0:cc2f9ea8cd1f | 116 | Byte 2 Floor marking character |
foxbrianr | 0:cc2f9ea8cd1f | 117 | Byte 3 Floor marking character (rightmost) |
foxbrianr | 0:cc2f9ea8cd1f | 118 | Byte 4 Message marking character (leftmost) |
foxbrianr | 0:cc2f9ea8cd1f | 119 | Byte 5 Message marking character |
foxbrianr | 0:cc2f9ea8cd1f | 120 | Byte 6 Message marking character (rightmost) |
foxbrianr | 0:cc2f9ea8cd1f | 121 | Byte 7 Lantern Position (ThyssenKrupp) |
foxbrianr | 0:cc2f9ea8cd1f | 122 | Byte 8 Unused |
foxbrianr | 0:cc2f9ea8cd1f | 123 | |
foxbrianr | 0:cc2f9ea8cd1f | 124 | */ |
foxbrianr | 0:cc2f9ea8cd1f | 125 | void GetMessage502(char * floor, char * msg, char lantern ) |
foxbrianr | 0:cc2f9ea8cd1f | 126 | { |
foxbrianr | 0:cc2f9ea8cd1f | 127 | } |