Hi,
I need to read 2 off 32 bit + 1 load bit serial streams of data into an Arduino (old CBUS that predates I2C protocol). I would then like to store the data in a variable or array in binary format. The data represents which segment to turn ON on a 64 segment LCD. For example
int32 low32 = 0xFFFFFFFF;
int32 high32 = 0xFFFFFFFF;
Turns ALL of the segments ON.
int32 low32 = 0x00000000; //ALL segments OFF
int32 high32 = 0x00000000; //
Turns ALL segments OFF.
int32 low32 = 0x48010000; //SEGMENTS 5A,5B,5C,5D,5E,5F,5G and 5L segments ON, Rest OFF. Shows number ZERO on DIGIT 5.
int32 high32 = 0x6C000001; // 4 BIT NIBBLE 1 (FROM LEFT) S30,31 NIBBLE 2 S27,28 NIBBLE 8 S1 LOW32 NIBBLE 1 S31 (5G), S28 (5L) NIBBLE 4 S17 (5A)
Here is the code I'm using to drive the LCD using a PIC microcontroller (PIC16F1847) and CCS PCM C compiler.
/*
FILENAME:REVOX_B261_PCE2111_LCD_TEST1.C
REVISION:0.1
Date:05 August 2022
Author: Original Ttelmah CCS INFO FORUM 04th August 2022 with contributions by David J S Briscoe
Purpose: This program is to test the Mullard/Philips PCE2111 Duplex 64 segment LCD driver on a Revox B261 FM tuner.
Status: 10th August:All segments are lit (apart from STORE and ANT-Check LCD connections.
Pin diagram
; Target Controller - PIC16F1847
;
; RS232-WHITE------RA2 |1 18| RA1-----------
; -----------------RA3 |2 17| RA0-----------
; -----------------RA4 |3 16| RA7-----------
; -----------------RA5 |4 15| RA6-----------
; GND--------------VSS |5 14| VDD-----------+5V
; PCE2111 DLEN-----RB0 |6 13| RB7-----------
; PCE2111 DATA-----RB1 |7 12| RB6-----------
; PCE2111 CLB------RB2 |8 11| RB5-----------
; -----------------RB3 |9 10| RB4-----------
;
;
NOTES:
*/
#include <16F1847.H>
#fuses INTRC_IO, NOWDT, NOBROWNOUT, PUT,NOPROTECT,MCLR,NOLVP
#use delay(clock=8000000)
#use RS232(baud=9600, xmit=PIN_A2,ERRORS) //RS232 on Pin A2
// Define pins for CBUS
#define DLEN PIN_B0
#define DATA PIN_B1
#define CLB PIN_B2 //set to suit you
int32 low32 = 0xFFFFFFFF; //ALL segments ON (apart from MUTING and ANT-They are on an independent backplane).
int32 high32 = 0xFFFFFFFF; //Use this to check connections to LCD. START WITH THIS SETTING
//int32 low32 = 0x00000000; //ALL segments OFF. Use this setting to work out segments to turn ON. One by one.
//int32 high32 = 0x00000000; //.
//int32 low32 = 0xFFDFFFFF; //STEREO (SEG 22)OFF (all others ON).
//int32 high32 = 0xFFDFFFFF; //
//int32 low32 = 0xFFFFFF7F; //25 OFF (SEG 8) ALL others ON.
//int32 high32 = 0xFFFFFFFF; //.
//int32 low32 = 0xFFFFFF7F; //25 OFF. POINT AND MHZ OFF
//int32 high32 = 0xFFFFFF7F; //
//int32 low32 = 0xFFFFFFFF; //75 OFF.25 AND 50 ON. 50 AND 75 SEG 32.
//int32 high32 = 0x7FFFFFFF; //
//int32 low32 = 0x7FFFFFFF; //50 OFF REST ON
//int32 high32 = 0xFFFFFFFF; //
//int32 low32 = 0xFFFFFFFF; //FIRST DIGIT OFF. Rest ON.
//int32 high32 = 0xFFDFFFFF; //
//int32 low32 = 0x00000000; //FIRST DIGIT ON. Rest OFF.
//int32 high32 = 0x00200000; //
//int32 low32 = 0x00000000; //POINT AND MHZ ON (S8). Rest OFF.
//int32 high32 = 0x00000080; //
//int32 low32 = 0x00000080; //POINT,MHZ AND 25 ON. Rest OFF.
//int32 high32 = 0x00000080; //
//int32 low32 = 0x48010000; //SEGMENTS 5A,5B,5C,5D,5E,5F,5G and 5L segments ON, Rest OFF. Shows number ZERO on DIGIT 5.
//int32 high32 = 0x6C000001; // 4 BIT NIBBLE 1 (FROM LEFT) S30,31 NIBBLE 2 S27,28 NIBBLE 8 S1 LOW32 NIBBLE 1 S31 (5G), S28 (5L) NIBBLE 4 S17 (5A)
//int32 low32 = 0x00020000; //SEGMENTS 4A(S18 NIBBLE 4,0X02),
//int32 high32 = 0x00000000; //
// CCS FORUM POST https://www.ccsinfo.com/forum/viewtopic.php?t=33377&start=11
// Modify diagram below as required.
// Change bit pattern and Hex codes to suit this application.
//
// Digit numbers:
// 8 7 6 5 4 3 2 -
// ----- ----- ----- ----- ----- ----- ----- -----
// |\|/| |\|/| |\|/| |\|/| |\|/| |\|/| |\|/| |\|/|
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// |/|\| |/|\| |/|\| |/|\| |/|\| |/|\| |/|\| |/|\|
// ----- ----- ----- ----- ----- ----- ----- -----
//
// Change these as needed.
//
// Segment Segment bit
// letters: numbers:
//
// a 15
// ------- -------
// |\ i| /| |\ 7| /|
// f| \ | / |b 10| \ | / |14
// | h\|/j | | 8\|/6 |
// g--- ---k 9--- ---5
// | l/|\n | | 4/|\2 |
// e| / | \ |c 11| / | \ |13
// |/ m| \| |/ 3| \|
// ------- -------
// d 12
//
// Segment bit numbers: Segment
// 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 hex code:
// 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 7 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
// 9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0x00000000
//
// E.G 0 1 1 1 1 1 1 - - - 1 - 1 - - - -
void init(void)
{
//call at start to ensure lines are low
output_low(DLEN);
output_low(CLB);
}
#inline
void clock()
{
//generate one bit clock
delay_us(8);
output_high(CLB);
delay_us(2);
output_low(CLB);
delay_us(8);
}
void send(int32 value, int1 lowhigh)
{
int ctr;
int32 mask=1; //data is output LSb first
output_high(DLEN);
delay_us(8);
//output 32bit value to either low or high register
output_low(DATA);
clock(); //first send a 0
for (ctr=0;ctr<32;ctr++)
{
if (value & mask)
output_high(DATA);
else
output_low(DATA);
clock();
mask*=2; //Modern compiler should optimise this to shift
}
if (lowhigh)
output_high(DATA);
else
output_low(DATA);
clock(); //clock out the bit to specify high/low register
output_low(DLEN);
clock(); //now clock this into the latches.
delay_us(8); //do not do anything else for 8uSec
}
void main(void)
{
int32 loop_cntr;
for( loop_cntr = 0; loop_cntr < 0xffff; loop_cntr++)
{
init(); //ensure bus is initialised
delay_us(100);
//low32--;
send(low32, 0); //load the low 32bits
send(high32, 1); //load the high 32bits.
//delay_us(100);
//printf("Loop count: %8LX\r\n", loop_cntr);
//printf("low32 value: %8LX\r\n", low32);
delay_ms(1000);
//printf("high32 value: %8LX\r\n", high32);
printf("WORKING...\r\n");
}
}
I am reverse engineering the LCD of a Revox B261 FM tuner that uses a mask programmed Philips mab8440p microcontroller. So first I'm driving the OEM display using the 16F1847 and working out the LCD mapping (a SLOW process). Next I want to intercept the serial data coming from the DATA, DLEN (data latch enable) and CLK (burst clock) pins of the mab8440p and do some pattern matching. I want to match the serial data that is read into an Arduino and compare it to a set of data words that represent 0 to 9 or A to Z as they appear on the LCD (the LCD mapping I'm doing). I have some experience reading switches and writing to the serial monitor on an Arduino. However I have NO experience in READING such a large data stream. Is this even possible with something like a NANO, UNO or would an ARM based MCU (i'm experimenting with the PI PICO for instance and I have a TEENSY 4.1) be better. I just need to get the job done so anything that will work with the Arduino IDE will be fine. Can someone give me an example of how to read this data? If you need any more info please let me know. Thanks.