Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
A bit OT, blame it on W8TEE
Mike Bryce
A bit off topic, but I'd like to show a project that started while I look for a cabinet for the BITX40 project.
It's a remote antenna switch. Jack, W8TEE, inspired me to try my hand at Ardunio coding. I suck, but this is the result. The board in the middle is the current limit and error board piggy backed to a switch board. The board to the left is the antenna port voltage divider. It also serves as an interconnect to the remote antenna RF switch, and provided BCD output as well. When you select an antenna, the Nano reads the resultant voltage and through a series of 8 (it's a 8 position switch) IF statements finds the one that meets the IF statement. The result is displayed on the LCD. I got inspired and added some more code that would display the rigs used on the LCD. I could switch up to 8 different transceivers/antennas. Got way over my head on that one as the LCD would flicker. I narrowed it down to my use of LCD.clear statements. So trashed the rig select and put in a RTC that on the very bottom line. Sure wish I knew what I'm doing. I'm Mike, WB8VGE |
Jack Purdum
Very nice!! It really makes me happy when I see others jumping into the fray and trying their hand at programming. Few things are as satisfying as getting a bunch of hot sand to do what you want. There's plenty of room on the Mega 2560 for the code, so box it up with the BITX, throw it in a (big) box, and have at it! Jack, W8TEE From: Mike Bryce <prosolar@...> To: [email protected] Sent: Tuesday, October 3, 2017 11:21 AM Subject: [BITX20] A bit OT, blame it on W8TEE A bit off topic, but I'd like to show a project that started while I look for a cabinet for the BITX40 project.
It's a remote antenna switch. Jack, W8TEE, inspired me to try my hand at Ardunio coding. I suck, but this is the result. The board in the middle is the current limit and error board piggy backed to a switch board. The board to the left is the antenna port voltage divider. It also serves as an interconnect to the remote antenna RF switch, and provided BCD output as well. When you select an antenna, the Nano reads the resultant voltage and through a series of 8 (it's a 8 position switch) IF statements finds the one that meets the IF statement. The result is displayed on the LCD. I got inspired and added some more code that would display the rigs used on the LCD. I could switch up to 8 different transceivers/antennas. Got way over my head on that one as the LCD would flicker. I narrowed it down to my use of LCD.clear statements. So trashed the rig select and put in a RTC that on the very bottom line. Sure wish I knew what I'm doing. I'm Mike, WB8VGE |
¿ªÔÆÌåÓýGreat Fun Project. Watch out, Jack will tell you to use a Case
Statement! So are there pictures of how you switch the antennas? The Action end?? Relays and stuff? Mike, WA6ISP On 10/3/2017 8:21 AM, Mike Bryce wrote:
A bit off topic, but I'd like to show a project that started while I look for a cabinet for the BITX40 project. -- Mike Hagen, WA6ISP 10917 Bryant Street Yucaipa, Ca. 92399 (909) 918-0058 PayPal ID "MotDog@..." Mike@... |
John P
On Tue, Oct 3, 2017 at 08:21 am, Mike Bryce wrote:
A bit off topic, but I'd like to show a project that started while I look for a cabinet for the BITX40 project.What Jack said! Writing code isn't all that hard once you learn the language. The important part is being able to define the problem to be solved and then think through how to solve it in a logical step by step manner. Once you've done that the rest is simply a language problem. Whenever I was teaching someone to program, I always told them to assume that the computer can do anything you want it to do; you just need to figure out the right thing to say to it. ? -- John - WA2FZW |
Jack Purdum
Wow...nice looking board. How much is the board? Jack, W8TEE From: Mike Bryce <prosolar@...> To: [email protected] Sent: Tuesday, October 3, 2017 12:19 PM Subject: Re: [BITX20] A bit OT, blame it on W8TEE Here is the RF end of the remote switch. |
Vince Vielhaber
To cure the flicker, store what you already wrote to the display (eg.
toggle quoted message
Show quoted text
rig). If it's the same as it was, don't rewrite it. void printrig(char *rig) { static oldrig; if(!strcmp(rig,oldrig)) return; else strcpy(oldrig,rig); ... } So to print the rig to the display, your print routine would remember the old value of rig and compare it to the new value. If they're the same, it returns. If they're not, the old value is updated. From there you just do your normal print however you're doing it. That's just one way of doing it, there are many others. Vince. I got inspired and added some more code that would display the rigs used --
Michigan VHF Corp. |
Jack Purdum
Vince: Should this be rewritten as: From: Vince Vielhaber <vev@...> To: [email protected] Sent: Tuesday, October 3, 2017 12:29 PM Subject: Re: [BITX20] A bit OT, blame it on W8TEE To cure the flicker, store what you already wrote to the display (eg. rig).? If it's the same as it was, don't rewrite it. void printrig(char *rig) { static oldrig; ? ? if(!strcmp(rig,oldrig)) ? ? ? ? return; ? ? else ? ? ? ? strcpy(oldrig,rig); ? ? ... } So to print the rig to the display, your print routine would remember the old value of rig and compare it to the new value.? If they're the same, it returns.? If they're not, the old value is updated.? From there you just do your normal print however you're doing it.? That's just one way of doing it, there are many others. Vince. > I got inspired and added some more code that would display the rigs used > on the LCD. I could switch up to 8 different transceivers/antennas. > Got way over my head on that one as the LCD would flicker. I narrowed it > down to my use of LCD.clear statements. > > So trashed the rig select and put in a RTC that on the very bottom line. > > Sure wish I knew what I'm doing. > I'm Mike, WB8VGE > -- ? Michigan VHF Corp.? ? ? ? ? ? ? ? ? |
Mike Bryce
On Tue, Oct 3, 2017 at 09:58 am, John P wrote:
On Tue, Oct 3, 2017 at 09:24 am, Jack Purdum wrote:John, I designed the board and laid it out using diptrace. I had a few made. They are expensive, because of the size of the board. The photo is deceptive as it's about 9" square. Here is a close up of the way I mount the SO-239 connectors. I'm Mike, WB8VGE |
Mike Bryce
Right now, I'm not sure. If there is enough interest, I'd do a short run of 50 or so.
I'm thinking about $20ish a pop The photo is deceptive, the board is about 9" square. Double sided, plated through holes, FR4 board, soldermask on both sides, silkscreen on both side. The relays are 16 A and each port has two in series. when no power, all ports are ground. I have yet to connect it to my spectrum analyzer but the last version worst case port to port on 50 mhz was 59 db down. On 1mhz, 85 db down Mike, WB8VGE |
Mike Bryce
After endless hours and more diet coke that should be allowed by law, I got the RTC to display on the LCD along with the antenna port.
I have this grandiose idea of when the switch is off (But power still applied to the Nano) that the display would show date/time. Turn on the switch and the date/time would scoot over to the bottom of the display like I have it here. I'd simply pull a digital pin to ground to let the Nano know if I want clock or switch. tried for weeks the other night and other than finding out that interrupts aren't the way to go, I went to bed. The flicker is still a sore in my side. I know the LDC.clear call is the problem. I've read about using CASE, and haven't tried it yet. All i do know is after Jack kinda pushed on me about learning to code this thing, I know more about the Ardunio today than last week. Here's the result of 36 hours of orange compile errors. I'm Mike, WB8VGE |
Another way to minimize LCD activity is to only display the text "delta".
The following function is one I created to display text on an LCD. The display being "broken" into a number of "fields" (row, column, and width) and when the function is called to display the text, it will only display the positions having changed. This function will also clear out anything in the row after the field. I have found this very handy. One other note, the changes to the display are done under mutex control because the program using this function is multi-threaded. I hope this helps, and doesn't confuse things too much. Although I will be happy to answer any questions. - Mark --------------------------------------------------------------------------------- /* Define the display information. */ #define ROW_MAXIMUM 4 #define COLUMN_MAXIMUM 20 #define FULL_ROW_WIDTH COLUMN_MAXIMUM #define HALF_ROW_WIDTH (COLUMN_MAXIMUM - (COLUMN_MAXIMUM / 2)) /* Display fields. */ #define DISP_DATE_TIME 0 #define DISP_WEEKDAY 1 #define DISP_SCHEDULE 2 #define DISP_PROG_NAME 3 #define DISP_ZONE_INFO 4 /* Must be last. */ #define DISP_MAX 5 char old_display_data[ROW_MAXIMUM][COLUMN_MAXIMUM]; void display_text(uint8_t field, const char *text) { uint8_t cur_column; uint8_t row; uint8_t start_column; uint8_t text_len = strlen(text); /* Make sure the field number is valid. */ if (field >= DISP_MAX) return; row = display_fields[field].row; start_column = display_fields[field].column; /* Only display the changed text. */ for (cur_column = 0; cur_column < display_fields[field].width; cur_column++) { /* If the end of the string, we are done. */ if (text[cur_column] == '\0') break; /* If the the character is different, write it and save for next time. */ if (old_display_data[row][start_column + cur_column] != text[cur_column]) { /* Lock the display mutex so the display may be updated. */ pthread_mutex_lock(&display_mutex); lcd_setCursor(row, start_column + cur_column); lcd_printc(text[cur_column]); /* We're done so unlock the display mutex. */ pthread_mutex_unlock(&display_mutex); old_display_data[row][start_column + cur_column] = text[cur_column]; } } /* If there is anything left in the row, clear it out. */ while (cur_column < display_fields[field].width) { /* Lock the display mutex so the display may be updated. */ pthread_mutex_lock(&display_mutex); lcd_setCursor(row, start_column + cur_column); lcd_printc(' '); /* We're done so unlock the display mutex. */ pthread_mutex_unlock(&display_mutex); old_display_data[row][start_column + cur_column] = ' '; cur_column++; } } |
I am trying to make a complete program with setup() and a loop() with your code.
I think it would be real useful. I am stuck here, what is display_fields a function somewhere? Compiler was asking, and I don't know enough to fix it? Maybe you have a complete example? On 10/3/2017 12:03 PM, Mark Pilant wrote: row = display_fields[field].row;Thanks, Mike, WA6ISP -- Mike Hagen, WA6ISP 10917 Bryant Street Yucaipa, Ca. 92399 (909) 918-0058 PayPal ID "MotDog@..." Mike@... |
Jack Purdum
I don't know where this code came from, but display_fields[] is an array of objects, but I don't know what. Who has the complete code? Jack, W8TEE From: Michael Hagen <motdog@...> To: [email protected] Sent: Tuesday, October 3, 2017 3:52 PM Subject: Re: [BITX20] A bit OT, blame it on W8TEE I am trying to make a complete program with setup() and a loop() with your code. I think it would be real useful. I am stuck here, what is display_fields a function somewhere? Compiler was asking, and I don't know enough to fix it? Maybe you have a complete example? On 10/3/2017 12:03 PM, Mark Pilant wrote: > row = display_fields[field].row; Thanks, Mike, WA6ISP -- Mike Hagen, WA6ISP 10917 Bryant Street Yucaipa, Ca. 92399 (909) 918-0058 PayPal ID? "MotDog@..." Mike@... |
Jack Purdum
Mark: Where is the display_fields[field].width object defined? I don't seem to have the source code. Jack, W8TEE From: Mark Pilant <mark@...> To: [email protected] Sent: Tuesday, October 3, 2017 3:03 PM Subject: Re: [BITX20] A bit OT, blame it on W8TEE Another way to minimize LCD activity is to only display the text "delta". The following function is one I created to display text on an LCD.? The display being "broken" into a number of "fields" (row, column, and width) and when the function is called to display the text, it will only display the positions having changed. This function will also clear out anything in the row after the field. I have found this very handy. One other note, the changes to the display are done under mutex control because the program using this function is multi-threaded. I hope this helps, and doesn't confuse things too much.? Although I will be happy to answer any questions. - Mark --------------------------------------------------------------------------------- /* Define the display information. */ #define ROW_MAXIMUM? ? ? ? 4 #define COLUMN_MAXIMUM? ? ? 20 #define FULL_ROW_WIDTH? ? ? COLUMN_MAXIMUM #define HALF_ROW_WIDTH? ? ? (COLUMN_MAXIMUM - (COLUMN_MAXIMUM / 2)) /* Display fields. */ #define? ? DISP_DATE_TIME? 0 #define? ? DISP_WEEKDAY? ? 1 #define? ? DISP_SCHEDULE? ? 2 #define? ? DISP_PROG_NAME? 3 #define? ? DISP_ZONE_INFO? 4 /* Must be last. */ #define? ? DISP_MAX? ? ? ? 5 char? ? ? ? ? ? old_display_data[ROW_MAXIMUM][COLUMN_MAXIMUM]; void display_text(uint8_t field, const char *text) { ? ? uint8_t? ? ? ? cur_column; ? ? uint8_t? ? ? ? row; ? ? uint8_t? ? ? ? start_column; ? ? uint8_t? ? ? ? text_len = strlen(text); ? ? /* Make sure the field number is valid. */ ? ? if (field >= DISP_MAX) return; ? ? row = display_fields[field].row; ? ? start_column = display_fields[field].column; ? ? /* Only display the changed text. */ ? ? for (cur_column = 0; cur_column < display_fields[field].width; cur_column++) { ? ? ? ? /* If the end of the string, we are done. */ ? ? ? ? if (text[cur_column] == '\0') break; ? ? ? ? /* If the the character is different, write it and save for next time. */ ? ? ? ? if (old_display_data[row][start_column + cur_column] != text[cur_column]) { ? ? ? ? ? ? /* Lock the display mutex so the display may be updated. */ ? ? ? ? ? ? pthread_mutex_lock(&display_mutex); ? ? ? ? ? ? lcd_setCursor(row, start_column + cur_column); ? ? ? ? ? ? lcd_printc(text[cur_column]); ? ? ? ? ? ? /* We're done so unlock the display mutex. */ ? ? ? ? ? ? pthread_mutex_unlock(&display_mutex); ? ? ? ? ? ? old_display_data[row][start_column + cur_column] = text[cur_column]; ? ? ? ? } ? ? } ? ? /* If there is anything left in the row, clear it out. */ ? ? while (cur_column < display_fields[field].width) { ? ? ? ? /* Lock the display mutex so the display may be updated. */ ? ? ? ? pthread_mutex_lock(&display_mutex); ? ? ? ? lcd_setCursor(row, start_column + cur_column); ? ? ? ? lcd_printc(' '); ? ? ? ? /* We're done so unlock the display mutex. */ ? ? ? ? pthread_mutex_unlock(&display_mutex); ? ? ? ? old_display_data[row][start_column + cur_column] = ' '; ? ? ? ? cur_column++; ? ? } } |
John P
On Tue, Oct 3, 2017 at 11:34 am, Mike Bryce wrote:
I designed the board and laid it out using diptrace. I had a few made. They are expensive, because of the size of the board. The photo is deceptive as it's about 9" square.Really a nice job. I'd be interested in seeing the schematic. I've been thinking of a remote antenna switch, but I don't need 8?ports! ? -- John - WA2FZW |
Hi Mike.
What I posted was mainly supposed to be an example of what could be done. It is part of a larger work in progress, a home sprinkler system built on a Raspberry Pi 3. (It evolved from an Arduino base because I wanted wireless access as well as web server access. By the time I would have added all the parts up, I would have more invested than a RPi3 :-) Jack, you are correct. It is part of a larger project. I didn't think it was appropriate to post it all; even as attachments. Since I've been wanting to put it out on GitHub for a while, I'll add a public repository and then post a pointer to it here. Hopefully I'll be able to get it done tomorrow. 73 - Mark N1VQW |
Jack Purdum
Mike: 36 hours is pretty good!! Also, you wouldn't have stuck with it that long if you weren't getting some kind of fun out of it. What's the flicker from? Is it when you update the screen? If so, what happens when you try this: #define SCREENWIDTH??? 20 #define SCREENHEIGHT??? 4 char spaces[SCREENWIDTH * SCREENHEIGHT + 1];?????? // Need room for NULL memset(spaces, ' ', SCREENWIDTH * SCREENHEIGHT);?? // Fastest way to set a buffer to one value, ?????????????????????????????????????????????????? // elements 0-79 are spaces spaces[SCREENWIDTH * SCREENHEIGHT] = NULL;???????? // Now it's one big string; spaces[80] = NULL At the point where you call LCD.clear(), try ?? // LCD.clear(); ?? LCD.print(spaces); and see what happens. If you see white smoke, disregard... Jack, W8TEE From: Mike Bryce <prosolar@...> To: [email protected] Sent: Tuesday, October 3, 2017 2:47 PM Subject: Re: [BITX20] A bit OT, blame it on W8TEE After endless hours and more diet coke that should be allowed by law, I got the RTC to display on the LCD along with the antenna port. I have this grandiose idea of when the switch is off (But power still applied to the Nano) that the display would show date/time. Turn on the switch and the date/time would scoot over to the bottom of the display like I have it here. I'd simply pull a digital pin to ground to let the Nano know if I want clock or switch. tried for weeks the other night and other than finding out that interrupts aren't the way to go, I went to bed. The flicker is still a sore in my side. I know the LDC.clear call is the problem. I've read about using CASE, and haven't tried it yet. All i do know is after Jack kinda pushed on me about learning to code this thing, I know more about the Ardunio today than last week. Here's the result of 36 hours of orange compile errors. I'm Mike, WB8VGE |
to navigate to use esc to dismiss