Remote control by location (PIC in Oshonsoft)

Thread Starter

camerart

Joined Feb 25, 2013
1,818
hi,
Tried a number of ideas, they will not work together in simulation, on receive.
E
Hi E,
I'm trying to follow your image #599.

RA4 should be input, and another should be output, I'm using RB3 as it is free. AN0 to AN4 are analogue inputs.

I've just noticed that I have ALLDIGITAL and Analogue pins set up. I'm trying no analogue pins to see what happens.

When using the SIM it stops at [ Serin PORTA.4, 9600, azi.LB, azi.HB ] I can't remember what to do next. What do I enter into the UART? SEROUT is showing in the UART.

C
 

ericgibbs

Joined Jan 29, 2010
9,561
hi,
Ref 599.
It was a test of the simulator to check if it is possible use a SW and HW port in the same program.

I chose PORTA4 and PORTA.5 as SW, as PORTC is used as the HW port.

I found when used together the program locks up.

I assume its the way OSH compiler uses the internal hardware of the 18F.

E
 

Thread Starter

camerart

Joined Feb 25, 2013
1,818
hi,
Ref 599.
It was a test of the simulator to check if it is possible use a SW and HW port in the same program.

I chose PORTA4 and PORTA.5 as SW, as PORTC is used as the HW port.

I found when used together the program locks up.

I assume its the way OSH compiler uses the internal hardware of the 18F.

E
Hi E,
To clarify: "I found when used together the program locks up." Do you mean when SW and HW are used together OSH can't work?

If so, then I will need to re-design the PCB. If you recall, I have a switch on the 18LF4620 RX. The switch is a two way switch, but I bought a four way switch for the above purpose.
C.
 

ericgibbs

Joined Jan 29, 2010
9,561
hi,
Thats what the simulation shows , they don't work together.
It supports what you are finding in your HW, you could drop Vlad a Debug message, see what he says.
E
 

Thread Starter

camerart

Joined Feb 25, 2013
1,818
hi,
Thats what the simulation shows , they don't work together.
It supports what you are finding in your HW, you could drop Vlad a Debug message, see what he says.
E
Hi E,
I just checked my PCB designs, and back in August, I had almost redesigned the latest PCB with a 4 way switch, and only using HSEROUT, HSERIN, so I'll carry on and finish it, and see if it works as expected.

I'm a bit puzzled, because up to a couple of weeks ago, the SERIN was working ok. I'll drop Vlad a message.
Thanks,
C.
 

ericgibbs

Joined Jan 29, 2010
9,561
hi,
Did you still have the Hseropen 9600 Code line in the test program.???
IF yes, this would assign PORT.6 & 7 as HW Uart pins,even though you do not use them.

E
 

Thread Starter

camerart

Joined Feb 25, 2013
1,818
Hi,
I've re-designed the PCB, here:

I've added a multi way DATA SWITCH, Here:

I'm still propogating the PCB, but the 18LF4620 is working. There are a few errors on the PCB.

I got a bit confused by the DATA SWITCH. Am I correct that for 1A-1B1,1B2,1B3 1B4 to work OE1 and OE2 should be LOW?

C.
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
1,818
Hi,
I've forgotten how to send and receive HSEROUT/IN. I suspect it's a string, where an example is in the program.
Here is the program. Looking under [On High Interrupt 'On Interrupt#####] is a section of serial in, but not HSERIN.
Can someone give me an example os HSEROUT (18F4431) and HSERIN (18LF4620) to test the switch please.
C.
 

Attachments

djsfantasi

Joined Apr 11, 2010
6,167
hi C,
This is a test program we did back in 2014.:rolleyes:
It has In and Out and some examples
E
Note: Line 54 has a Break, just rem it out.
Hi,
I've forgotten how to send and receive HSEROUT/IN. I suspect it's a string, where an example is in the program.
Here is the program. Looking under [On High Interrupt 'On Interrupt#####] is a section of serial in, but not HSERIN.
Can someone give me an example os HSEROUT (18F4431) and HSERIN (18LF4620) to test the switch please.
C.
Sorry, I can’t give you an example. But HSERIN() doesn’t return a string. It returns a byte representing a single character.

You can construct a string from a series of characters yourself. For each character read, append it to a string until you reach a termination character.

At least that’s what I’ve needed to do I’m another language. The only exception has been where all inputs have been one character and I could ignore/discard everything else.

This is a different way of thinking. If you can get it, great! Otherwise, I hope I haven’t confused the situation.
 

ericgibbs

Joined Jan 29, 2010
9,561
hi dl,
This is a clip from the above file,
For convenience when using the Sim, we use the '?' as an end of line for testing.
E

read0:
Hserin char
char = Chr(char)
'
If char <> "$" Then Goto read0
nxtchr:
For x = 0 To 5
Hserin char
If char = "?" Then Goto echoout
inpmsg = inpmsg + Chr(char)
Next x
 

djsfantasi

Joined Apr 11, 2010
6,167
hi dl,
This is a clip from the above file,
For convenience when using the Sim, we use the '?' as an end of line for testing.
E

read0:
Hserin char
char = Chr(char)
'
If char <> "$" Then Goto read0
nxtchr:
For x = 0 To 5
Hserin char
If char = "?" Then Goto echoout
inpmsg = inpmsg + Chr(char)
Next x
Yep! I got it, eg.

I was responding to c’s post. Specifically this.

I've forgotten how to send and receive HSEROUT/IN. I suspect it's a string, where an example is in the program.
 

Thread Starter

camerart

Joined Feb 25, 2013
1,818
Sorry, I can’t give you an example. But HSERIN() doesn’t return a string. It returns a byte representing a single character.

You can construct a string from a series of characters yourself. For each character read, append it to a string until you reach a termination character.

At least that’s what I’ve needed to do I’m another language. The only exception has been where all inputs have been one character and I could ignore/discard everything else.

This is a different way of thinking. If you can get it, great! Otherwise, I hope I haven’t confused the situation.
Hi D,
I can follow, E's example, and I'll try it. It looks like both languages use the same method.
Thanks,
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
1,818
Hi,
First I tried adding the QEI sequence into the MAIN program, where there are many duplicated parts e,g, CHR is used elsware, so I changed the names. It didn't work:(

Here is a shorter version.
Note: ACHR doesn't work as WORD, so I changed it to a STRING? It still doesn't work

The 18F4431 is outputting [ Hserout "QEIDEG= ", #QEIDEG, CrLf ]
C.
 

Attachments

Top